How to create a stored procedure (for SQL Server 2000 / 2005) to swap 2 records excluding a few columns, it has to get ‘table name’, ‘record id (2 id)’ and ‘column to exclude’ as a parameter. Here columns are dynamic as we get ‘table’ as a parameter and number of columns may be more than 50.
Here I believe, ‘update [table name] set [field] = [value] ……’
Type statements will be very lengthy as the number of columns will be more than 50 and it is a variant.
Is there any simple way to swap records in SQL Server 2000/2005?
Check this answer by Tom H. to similar question.
Also this solution posted on SQLServerCentral may be helpful to you (the site requires registration but it is free)