sql server造100万数据

 1 /*创建表*/
 2 create table tb(
 3 km_h int,
 4 zkzh int,
 5 ss_h int,
 6 zw_h int
 7 )
 8 
 9 //科目号|考生编号|室试号|座位号
10 //1    158994    590    94
11 
12 drop table tb;        //删除表数据和表结构
13 delete  from tb;    //删除表数据,保留表结构
14 select * from tb;    //查询表数据
15 
16 /*使用sql server插入100万数据*/
17 declare @zkzh int,
18         @ss_h int,
19         @zw_h int;
20 set @zkzh=100001;
21 while @zkzh<=1100000
22 begin
23     set @ss_h=1;
24     while @ss_h<=10000
25     begin
26         set @zw_h=1;
27         while @zw_h<=100
28         begin
29             insert into bigdata.dbo.tb(km_h,zkzh,ss_h,zw_h) values(1,@zkzh,@ss_h,@zw_h);
30             set @zw_h=@zw_h+1;
31             set @zkzh=@zkzh+1;
32         end;
33     set @ss_h=@ss_h+1;
34     end;
35 end;

猜你喜欢

转载自www.cnblogs.com/celine/p/9101871.html
今日推荐