当前位置: 移动技术网 > IT编程>数据库>MSSQL > 为数据库生成某个字段充填随机数的存储过程

为数据库生成某个字段充填随机数的存储过程

2017年12月12日  | 移动技术网IT编程  | 我要评论

峰峰帅哥,重生之若叶倾城,杨公祭

复制代码 代码如下:

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

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网