有一个查询:
UPDATE MyTable SET nvarchar1 = 'blahblah'
WHERE Id = '096fe792-7313-416f-b3c8-327f46be73b6' AND nvarchar1 <> 'blablah'
当nvarchar1为NULL时,它不起作用。我应该如何更改才能使其正常工作?
此致
答案 0 :(得分:2)
UPDATE MyTable SET nvarchar1 = 'blahblah'
WHERE Id = '096fe792-7313-416f-b3c8-327f46be73b6'
AND (nvarchar1 IS NULL
OR nvarchar1 <> 'blablah')
你是说这个吗?
答案 1 :(得分:0)
UPDATE MyTable SET nvarchar1 = 'blahblah'
WHERE Id = '096fe792-7313-416f-b3c8-327f46be73b6' AND isnull(nvarchar1,'') <> 'blablah'