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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2007-03-05 : 10:47:19
|
| Guddu writes "Hi i am trying to swap the column names of a table. Consider a table having employee details and cols as First_Nane,Second_Name,Age,Employee_Id,Address. While entering data i have entered The details of FirstName in the Second_Name column and of the SecondName in the First_Name. Now i need to swap the column names without using a temp table or a column name. Is it possible. Something like the swap we perform in C without a temp variable." |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-05 : 10:53:10
|
| [code]declare @t table( a varchar(10), b varchar(10))insert @tselect 'aa', 'bb' union allselect 'pp', 'qq' union allselect 'xx', 'yy'-- before updateselect * from @tupdate @tset a = b, b = a-- after updateselect * from @t[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|
|