--查询表是否有自增字段
SELECT OBJECTPROPERTY(OBJECT_ID('[表名]'), 'TableHasIdentity')
--查询表的自增字段
SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.columns
WHERE TABLE_NAME = '[表名]'
AND COLUMNPROPERTY(OBJECT_ID('[表名]'), COLUMN_NAME, 'IsIdentity') = 1
--获取SQL自增列种子和增量
SELECT IDENT_SEED('[表名]') AS Seed,
IDENT_INCR('[表名]') AS Incr
--【查看】表当前种子
DBCC CHECKIDENT('[表名]', NORESEED)
--【查询】表当前种子
SELECT IDENT_CURRENT('[表名]')
--重置种子
DBCC CHECKIDENT('[表名]', RESEED, 50)