2
Answers

Problem with IDENT_CURRENT( ) Function

I'm developing a database application with C#. My database management system is SQL server 2005. I'm using the IDENT_CURRENT( ) function to get the ID of the last inserted row in data tables.

According to the documentation IDENT_CURRENT( ) function should return null when invoked against a newly created empty table. However in my application it returns 1 for that kind of tables. Any idea why it behaves like that?

Also please do let me if there is a better way to get the last inserted ID from a data table...
Answers (2)