我有一个SQL Server数据库,我试图在其中一个表上运行更新脚本,但它一直说“0行影响”。更新脚本不工作 - 0受影响的行
如果我运行下面的脚本,它说:“33行受到影响”
UPDATE [StoreTestDB].[dbo].[ProductVariant]
SET [IsDefault] = 0,
[Published] = 0
WHERE ProductID = 19
但是,如果我运行下面的脚本,它说:“0行受到影响”:
UPDATE [StoreTestDB].[dbo].[ProductVariant]
SET [IsDefault] = 0,
[Published] = 0
WHERE ProductID = 19
AND ProductID = 20
AND ProductID = 23
AND ProductID = 24
AND ProductID = 25
AND ProductID = 27
AND ProductID = 28
AND ProductID = 29
AND ProductID = 30
AND ProductID = 31
AND ProductID = 32
AND ProductID = 33
AND ProductID = 54
AND ProductID = 55
AND ProductID = 56
AND ProductID = 57
AND ProductID = 58
AND ProductID = 64
AND ProductID = 71
AND ProductID = 72
AND ProductID = 73
AND ProductID = 74
AND ProductID = 75
AND ProductID = 77
AND ProductID = 105
AND ProductID = 109
AND ProductID = 152
AND ProductID = 157
AND ProductID = 158
AND ProductID = 162
AND ProductID = 164
AND ProductID = 165
AND ProductID = 167
AND ProductID = 169
AND ProductID = 170
AND ProductID = 173
AND ProductID = 174
我在做什么这里错了吗?
我确定productIDs有一个IsDefault = 1和Published = 1,这就是为什么我想运行该脚本。
任何想法?
感谢你给一个交代,你给我清楚的例子。我已将您的答案标记为我选择的解决方案。非常感谢! – PD24
@ PD24:不客气;) – Marco