Hi weitzera
weitzera (1/20/2010)
The sample script works because you're using Table variables, which are local to the scope. If you use real tables, it is not guaranteed to work, as pointed out in the article, because the IDs of your insert are not guaranteed to be in order or consecutive, so you cannot calculate the IDs of the other rows from the ID of the last row.
Be careful to not confuse an insert of many rows in a single command with a BULK INSERT
http://msdn.microsoft.com/en-us/library/ms188365.aspx%5B/quote%5D
Unfortunately, I don't have any resource which guarantees this works or doesn't work. Just can say I tried this in several combinations with real tables, different orders and up to 50 concurrent processes. It worked in all my tests. (I don't have a complete test environment at the moment.)
Greets
Flo