如果参数值或单元格值为null,如何进行null检查

时间:2015-11-12 19:59:11

标签: sql-server

如果参数值或单元格值为空,如何进行空值检查

--Update into BudCustomers from Bulk
Update BudCustomers
 set    BudCustomers.ImportedRecord = ImportedRecord
       ,BudCustomers.VersionID = @VersionId
       ,BudCustomers.STATUSID = @StatusId
FROM BudCustomers BCUST
JOIN External_Blk_Itm_Contracts EBIC ON BCUST.LegalName = EBIC.CustomerName
Where     BCUST.ImportedRecord <> @ImportedRecord
       OR BCUST.STATUSID <> @StatusId

1 个答案:

答案 0 :(得分:1)

Where ((BCUST.ImportedRecord <> @ImportedRecord) OR (BCUST.ImportedRecord IS NULL AND @ImportedRecord IS NULL))

然后是其他列/参数对的相同模式。