Hi all,

According to:

https://connect.microsoft.com/SQLServer/feedback/details/328811/scope-identity-sometimes-
returns-incorrect-value 

SCOPE_IDENTITY() has a bug that causes it to fail whenever parallelism kicks in 
(a more common 
occurence these days with the proliferation of multiprocessor machines).

Microsoft has been unable to solve the problem, and the bug is still open on 
Connect.

One of the workaround specified is the following:
2. Read the value from SELECT part into a set of variables (or single table 
variable) and then 
insert into the target table with MAX_DOP=1. Since the INSERT plan will not be 
parallel you will get 
the right semantic, yet your SELECT will be parallel to achieve performance 
there if you really 
need it.

But as far as I can figure out, this workaround should not need the MAX_DOP=1 
option, because 
when inserting from values, there won't be a parallel case! My insert statement 
is always inserting 
a single row. Is this correct?

Regards,
Tony

Reply via email to