SQL Server 添加一条数据获取自动增长列的几种方法
数据库表设计
邓老师(老邓教的)
insert into TestOne values('011','Test011') select @@IDENTITY as '自动增长ID'
杨老师(老杨教的)
insert into TestOne output inserted.ID as '自动增长ID' values('010','Test010')
最近偷的((*^__^*) 嘻嘻……)
insert into TestOne values('013','Test013') select isnull(cast(scope_identity() as bigint), -99999999) as '自动增长ID'