我的桌子有很多行。我必须满足这样的要求,那就是只更新那些2的倍数的行。 e.g。
update [DBO].[ZZZ_FKP_FEMALE_FULLNAME_TBL]
set remarks = 'multiple of TWO'
--- update only those rows which are multiple of 2.
--- where ID = MULTIPLE OF 2
here ID column is primary key with auto increment
我该如何解决这个问题?
答案 0 :(得分:3)
你可以使用modulo作为@jarlh说,这里是代码:
UPDATE T SET T.remarks = 'multiple of TWO'
FROM [DBO].[ZZZ_FKP_FEMALE_FULLNAME_TBL] AS T
WHERE ID % 2 = 0
答案 1 :(得分:0)
update [DBO].[ZZZ_FKP_FEMALE_FULLNAME_TBL] set remarks = 'multiple of TWO'where ID % 2 = 0