SCOPE_IDENTITY problem after migrating from SQL Server 2000 to SQL Server 2005 when using ODBC API
Posted on 2006-11-16
Hi to all,
I have a little problem using the SCOPE_IDENTITY to get the latest identity value inserted after an "INSERT INTO" statement, and this, using the ODBC API.
After inserting the row, I make a "SELECT SCOPE_IDENTITY()" to get the inserted ID but the return value is = 0.
If I use "SELECT @@IDENTITY" to get the identity, the returned ID is correct.
All was working fine under SQL Server 7 and SQL Server 2000 (after MDAC upgrade).
Any idea ?
P.S. : Under Query Analyser, the SCOPE_IDENTITY is working.