条件查询语句 (查询和修改为一体)
update Student set StudentResult ='1291' where exists(Select *From Student where StudentResult <1291)
更新前
使用变量更新数据
DECLARE @i int
DECLARE @ADD int
Set @ADD = '1291'
DECLARE @NO int
Set @NO = '1100'
while @i < 33
Begin
update Student set StudentResult = @ADD where StudentResult ='1291' AND StudentNo = @NO
Set @ADD = @ADD + 1
SET @NO = @NO + 1
Set @i = @i + 1
END
更新之后