您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

得到自增列的下一个会插入的id

2024/4/17 13:40:45发布9次查看
怎么得到自增列的下一个会插入的id
代码如下:
declare @table_name varchar(60)
set @table_name = 'pay_inputpay';
select so.name table_name, --表名字
sc.name iden_column_name, --自增字段名字
ident_current(so.name) curr_value, --自增字段当前值
ident_incr(so.name) incr_value, --自增字段增长值
ident_seed(so.name) seed_value --自增字段种子值
from sysobjects so
inner join syscolumns sc
on so.id = sc.id
and columnproperty(sc.id, sc.name, 'isidentity') = 1
where upper(so.name) = upper(@table_name)
--@table_name是传入参数 表名 curr_value这个就是准备插入的id
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product