Monday, February 7, 2011

SCOPE_IDENTITY() returns incorrect value - Microsoft SQL Server 2005/2008/2008 R2 (x86, x64)

As you probably know SCOPE_IDENTITY() is broken.
Effects versions: Microsoft SQL Server 2005/2008/2008 R2 (x86, x64). Bug is still not fixed thought it was submitted tow years ago (on 2/15/2008 4:2, 0:09 PM). Here is workaround.