Matthew Cushing (8/30/2012)
Going to give it a try now, but I'm unsure what this does:ROW_NUMBER() OVER( ORDER BY position_id) + @new_position_id - 1
That's taking the new position_id and adding the Row Number minus 1 to avoid a gap between sets.
I'm guessing your SP GetUpLdNextInstance is doing something like this:
SELECT ISNULL( MAX( idcolumn), 0) + @Increment
FROM IDsTable
WHERE Table = @Table
AND Column = @Column
Am I correct?
Are you sure the new_position_id is getting the same value on every row? Can you check what is it trying to insert?