• Carlo Romagnano (12/31/2010)


    Here a real situation for using local variable in the update statement.

    Carlo,

    I'm curious as to the context of your code (not included here for brevity and because somewhere between me and SQLServerCentral.com is a stupid IPS that thinks any text with a certain common SQL word in it is an injection attack) -- I'm guessing you abbreviated the row process in what you posted from some form of dynamic SQL.

    I'm curious for an explanation of why you're doing row-by-row processing here instead of set-based operations.

    Also, have you tested this implementation against a cursor-based implementation?