update table set down=floor(rand()*1000)
这样的语句,想更新整个表所有记录,是不行的,因为随机数只产生了一次,这样的语句执行后,整个表的所有记录的down字段的值是一样的
乖乖的写个循环吧
declare @i int
set @i=0
while @i<801
begin
update table set down =floor(rand()*1000)
set @i=@i+1
end
sqlserver尽然不支持for循环,汗!
update table set down=floor(rand()*1000)
这样的语句,想更新整个表所有记录,是不行的,因为随机数只产生了一次,这样的语句执行后,整个表的所有记录的down字段的值是一样的
乖乖的写个循环吧
declare @i int
set @i=0
while @i<801
begin
update table set down =floor(rand()*1000)
set @i=@i+1
end
sqlserver尽然不支持for循环,汗!

被折叠的 条评论
为什么被折叠?