Swap data between two columns in SQL SERVER

Experts,

I have a database table that looks like this:

RecordID     Code          Desc1        Desc2
1                CBY-100     Insert         Mill0.1
2                CBY-101     Insert         Mill1.3
3                CBY-102     Insert         Mill2.4
4                CBY-103     Insert         Mill3.2

I would like to swap out the descriptions so that it looks like this:

RecordID     Code          Desc1        Desc2
1                CBY-100     Mill0.1       Insert
2                CBY-101     Mill1.3       Insert
3                CBY-102     Mill2.4       Insert
4                CBY-103     Mill3.2       Insert

I know how to update one field but i can't seem to do both at the same time. As always any and all help is appreciated.

Raul.
Dakid24Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

m1tk4Commented:
1. Rename Desc2 to Desc3
2. Rename Desc1 to Desc2
3. Rename Desc3 to Desc1
0
Aneesh RetnakaranDatabase AdministratorCommented:
Better to rename the column

exec sp_rename 'TableName.Desc1',Desc3,  'COLUMN'
exec sp_rename 'TableName.Desc2',Desc1,  'COLUMN'
exec sp_rename 'TableName.Desc3',Desc2,  'COLUMN'
0
LowfatspreadCommented:
update tablename
  set desc1 = desc2 , desc2 = desc1
 where desc1 <> desc2

should do it....




 
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dakid24Author Commented:
Thanks for the quick response. All tips worked. I wanted to split up the points three ways by 200 but it wouldn't let me. I took the UPDATE statement as my answer. Thanks for all the help again, you experts rock.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.