How to "select" the current identifier value for a table?

dbcc checkident (MyTable, NORESEED)

Will show the identification value in the message. I do not see the message, because I need to select the identifier value through the DataReader .

Any ideas?

Thanks guys

+4
source share
3 answers
 SELECT IDENT_CURRENT('MyTable') 

See BOL

+8
source
 SELECT IDENT_CURRENT('TABLE_NAME') 

returns NULL if no identifier is specified in the table

+5
source
  select @@identity 

can work,

also exists

 SELECT SCOPE_IDENTITY() 
+1
source

All Articles