【发布时间】:2011-12-16 08:27:18
【问题描述】:
我有一个 SQL Server 数据库,我正在尝试在其中一个表上运行更新脚本,但它一直说“0 Rows Affected”。
如果我运行以下脚本,它会显示“33 Rows Affected”
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
我在这里做错了什么?
我确定 productID 的 IsDefault = 1 和 Published = 1,这就是我要运行脚本的原因。
有什么想法吗?
【问题讨论】:
标签: sql sql-server-2005 tsql sql-server-2008 sql-update