开发者

How to 'select' the current identity value for a table?

开发者 https://www.devze.com 2023-01-22 14:44 出处:网络
dbcc checki开发者_如何学Godent (MyTable, NORESEED) Will show the identity value in a message. I can\'t see the message as I need to select the identity value through a DataReader.

dbcc checki开发者_如何学Godent (MyTable, NORESEED)

Will show the identity value in a message. I can't see the message as I need to select the identity value through a DataReader.

Anyone any ideas?

Thanks folks


SELECT IDENT_CURRENT('MyTable')

See BOL


SELECT IDENT_CURRENT('TABLE_NAME')

returns NULL if there is no identity defined in the table


 select @@identity

might work,

there is also

SELECT SCOPE_IDENTITY()
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号