4

dbcc checkident (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

4

3 に答える 3

9
SELECT IDENT_CURRENT('MyTable')

See BOL

于 2010-10-28T13:07:45.617 に答える
5
SELECT IDENT_CURRENT('TABLE_NAME')

returns NULL if there is no identity defined in the table

于 2010-10-28T13:07:59.013 に答える
1
 select @@identity

might work,

there is also

SELECT SCOPE_IDENTITY()
于 2010-10-28T13:07:54.237 に答える