tags:

views:

99

answers:

1

How to create a Stored procedure (SQL 2005/2000) to swap 2 records excluding 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 2005/2000?

A: 

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)

kristof