create table tblInsert
(
id int identity(1,1) primary key,
name nvarchar(10)
); insert into tblInsert(name) values('张三'); select * from tblInsert; insert into tblInsert(name) values('李四');
select @@IDENTITY;--方式一 -- 使用inserted临时表 方式二
insert into tblInsert(name) output inserted.id values('王五');