How to copy row into same table - MS SQL
Posted on 2009-07-08
I have a datatable with around 50 columns, and I need a way to copy a row.
But before the insert is runned I need to change some column values.
I have Tabel: Profile
Which have columns: system_id, name + 50 other.
Lets say I have rows:
system_id name + 50
I want to copy row with system_id 52 into the same table, but change the system_id and name first.
I have variables containing the new values that will replace the old ones, @system_id and @name. But I'm unsure on how to do this.
Do I have to create a temp table containing all the 50 columns, or is there an easier way to do this?
If you need more clarification please ask.
Thanks in advanced:)