Hi David,
You're welcome. If you want speed you've to go with set oriented processing. That waht SQL Server is optimized for.
>Well, the speed difference wasn't as good as I had hoped. Identifying a duplicate, changing all referencing foreign keys to the original, and deleting the duplicate record used to take about 1.5 seconds per record and after implementing your example, it is down to about 1.1 seconds. The performance is noticeably better, but I had hoped for "blazing". Overly optimistic guessing must be a dead giveaway that a programmer is green.
>
>What I didn't take into account in my optimistic forecast was that removing a lot of string concatenations and dynamic command compilations would speed things up, but adding an additional level of embedded stored procedures would slow things down, i.e., my top-level SP calling sp_executesql which called my child-level SP. Also, sp_executesql must have to parse through the string I am passing.
>
>Thanks for your help, Sergey. I got a performance boost which will be significant when you consider the scope of the records that I will be running this on. I just need to learn to hope more conservatively.
>
>
--sb--