I've been searching hi and low for an answer to this and figured I would turn to the stackoverflow community. I have been avoiding using type identity id fields fields within sql server and nhibernate due to this bug: http://connect.microsoft.com/SQLServer/feedback/details/328811/scope-identity-sometimes-returns-incorrect-value
However, I just noticed that it was marked as fixed.
Does, anybody know if this applies to the recent SQL server service pack that was released? I can't find a yes or no to this.
My suggestion would be to try the query and test your results. There are a number of work arounds on this such as Output clause and run query not in parralel.
See Microsoft KB on this http://support.microsoft.com/kb/2019779
Also a post on this that indicated not sure if fixed in 2008 SP1 but may be fixed in 2008 R2
http://blog.sqlauthority.com/2009/03/24/sql-server-2008-scope_identity-bug-with-multi-processor-parallel-plan-and-solution/
1.4m articles
1.4m replys
5 comments
57.0k users