Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Swap data between fields

Author  Topic 

Mikele
Starting Member

3 Posts

Posted - 2005-07-05 : 09:18:08
After a cocked up import,

How can I swap the first-name / Last-name data for all records in my customer table.



thanks in advance

Mike

mwjdavidson
Aged Yak Warrior

735 Posts

Posted - 2005-07-05 : 09:26:36
UPDATE dbo.Customer
SET FirstName = LastName, LastName = FirstName

Might want to put this in a transaction, check the results and rollback to make sure you're happy before committing...
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-07-05 : 10:02:11
and make sure both columns have same data width

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -