sql 手写建表+插入数据
1
create database data_Test --创建数据库data_Test
2
GO
3
use data_Test
4
GO
5
create table tb_TestTable --创建表
6
(
7
id int identity(1,1) primary key,
8
userName nvarchar(20) not null,
9
userPWD nvarchar(20) not null,
10
userEmail nvarchar(40) null
11
)
12
GO

2

3

4

5

6

7

8

9

10

11

12

然后我们在数据表中插入2000000条数据:
1
--插入数据
2
set identity_insert tb_TestTable on
3
declare @count int
4
set @count=1
5
while @count<=2000000
6
begin
7
insert into tb_TestTable(id,userName,userPWD,userEmail) values(@count,'admin','admin888','lli0077@yahoo.com.cn')
8
set @count=@count+1
9
end
10
set identity_insert tb_TestTable off

2

3

4

5

6

7

8

9

10
