Home > Database > Mysql Tutorial > 为数据库生成某个字段充填随机数的存储过程

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

WBOY
Release: 2016-06-07 18:00:25
Original
996 people have browsed 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 @CurrentRecordBegin
set @Value= @BeginNum+(@EndNum - @BeginNum)*rand()
update [tableName] set [columnName] = @Value where [IDColumnName] = @CurrentRecord
set @CurrentRecord=@CurrentRecord+1
End
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template