数据库自增长的插入:
1子增长的插入
2/*创建表*/
3create table teacher
4(
5 id int identity(1,1) primary key not null,
6 name varchar(20)
7)
8
9select * from teacher
10
11/*关闭自增长*/
12SET IDENTITY_INSERT teacher on
13
14insert into teacher(id,name) values(2000,'guo')
15
16/*打开自增长*/
17SET IDENTITY_INSERT teacher off
18
19insert into teacher(name) values('guo')
2/*创建表*/
3create table teacher
4(
5 id int identity(1,1) primary key not null,
6 name varchar(20)
7)
8
9select * from teacher
10
11/*关闭自增长*/
12SET IDENTITY_INSERT teacher on
13
14insert into teacher(id,name) values(2000,'guo')
15
16/*打开自增长*/
17SET IDENTITY_INSERT teacher off
18
19insert into teacher(name) values('guo')