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)
 Rearrange a column in table

Author  Topic 

KENI
Starting Member

6 Posts

Posted - 2008-11-14 : 21:35:03
I have a problem with the table I want rearrange this..


sample table
CustomerName
,CUstAddress
,CustPhone
,CustomerID


I want a result like this

sample table
CustomerID ,CustomerName
,CUstAddress
,CustPhone

note..the customerId will be the first..

thanks in advance..

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-11-14 : 21:46:07
You need to export data to staging table and Recreate table with necessary columns in order and import it back.
Also it doesn't matter with order for column.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-15 : 00:24:47
not sure why you want to do this. you can always retrieve the data in order you want. just specify columns according to your order. keeping the table as it as and using below query will still provide you data in order you wanted.
select CustomerID ,CustomerName,CUstAddress,CustPhone from yourtable
Go to Top of Page
   

- Advertisement -