為數據庫生成某個字段充填隨機數的存儲進程。本站提示廣大學習愛好者:(為數據庫生成某個字段充填隨機數的存儲進程)文章只能為提供參考,不一定能成為您想要的結果。以下是為數據庫生成某個字段充填隨機數的存儲進程正文
Declare @CurrentRecord int,@BeginNum int, @EndNum int, @TotalCount int,@Value int
set @BeginNum=0
set @EndNum=500
set @TotalCount=80
set @CurrentRecord=1
While @CurrentRecord<=@TotalCount
Begin
set @Value= @BeginNum+(@EndNum - @BeginNum)*rand()
update [tableName] set [columnName] = @Value where [IDColumnName] = @CurrentRecord
set @CurrentRecord=@CurrentRecord+1
End