1 create table tblInsert
 2 (
 3     id int identity(1,1) primary key,
 4     name nvarchar(10)
 5 );
 6 
 7 insert into tblInsert(name) values('张三');
 8 
 9 select * from tblInsert;
10 
11 insert into tblInsert(name) values('李四');
12 select @@IDENTITY;--方式一
13 
14 -- 使用inserted临时表   方式二
15 insert into tblInsert(name) output inserted.id values('王五');

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-23
  • 2022-12-23
  • 2021-07-04
  • 2021-10-17
  • 2022-12-23
  • 2021-11-10
  • 2022-12-23
相关资源
相似解决方案