创建一个测试表,再写个存储过程循环插入5条记录
sql如下:
declare @usercount int
set @usercount=5
while @usercount
>0
begin
insert into
hr_tab_user(staffNumber,staffName,hrdeptcode,wz)
values(@usercount,‘test‘,‘fr‘,‘0‘)
set
@usercount=@usercount-1
end
不过这样的循环在业务上好像用途不大,只能在初始化测试数据上用的上,比如需要100万条测试数据。
那就可以用这种方法来初始化数据。
原文:http://www.cnblogs.com/sportdog/p/3557510.html