MSSQL随机数初始化字段整形值:*************************************
begin tran
Declare @ID varchar(64)
Declare Items Cursor local for select ID from xxxx表 --读出所有内容到游标
Open Items
Fetch Items into @ID
while (@@Fetch_Status=0)
Begin
update xxxx表 set 字段名=CONVERT(int,RAND() * 1000) where id=@ID
IF (@@ERROR<>0)
Begin
rollback tran
Raiserror('出现错误,没有任何数据被修改!',16,1)
return
End
Fetch Items into @ID
end
Close Items
Deallocate Items
commit tran