如果你想让主健增1,可以在设置主键的时候改为
create table table1(id int identity(1,1) not null,field1 varchar(50)),这样在插入的时候只要插入field1的值即可,不用查找id的值进行插入了。
create table table1(id int identity(1,1) not null,field1 varchar(50)),这样在插入的时候只要插入field1的值即可,不用查找id的值进行插入了。
2、触发器实现,但需要处理代码。