MSSQL随机数初始化字段整形值:*************************************begin tranDeclare @ID varchar(64)Declare Items Cursor local for select ID from xxxx表 --读出所有内容到游标Open ItemsFetch 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 @IDendClose ItemsDeallocate Itemscommit tran