一部の列に null 値がない場合にテーブルを更新する SQL スクリプトを作成したいのですが、null 値がある場合、更新ステートメントは実行されません。ここのコードでエラーが発生し、else ブロックが実行されます。なぜですか?
IF EXISTS(select 1 from Trendline.Invoices where Trx_Date is null or Trx_no is null or OperaKey is null)
RAISERROR('This script can not been executed because of null value/values in this columns.',0,1)
ELSE
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
GO
ALTER TABLE Trendline.Invoices
DROP CONSTRAINT FK_Invoices_RecSkpUser
GO
ALTER TABLE Trendline.Invoices
DROP CONSTRAINT FK_Invoices_RecConfSkpUsr
GO
ALTER TABLE Trendline.Invoices
DROP CONSTRAINT FK_Invoices_FollowUpSkpUsr
GO
ALTER TABLE TaeppaCore.Users SET (LOCK_ESCALATION = TABLE)
GO
COMMIT
BEGIN TRANSACTION
GO
ALTER TABLE Trendline.Invoices
DROP CONSTRAINT FK_Invoices_Currencies