Home > Archive > MS SQL Server > March 2006 > Can u swap the columns after creation of table









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Can u swap the columns after creation of table
satish

2006-03-06, 7:23 am

hi,
my doubt is --can u swap the columns of the table
ie..,
create table dd(f int ,e int ,g int)
table structure ;

f e g
1 2 4

now i want the columns to be swaped as : e f g

i know i can get the answer by using a select statement
select e,f,g from dd

but i want to get the table struncture as as e f g
when i write --------- select * from dd
i have to get the structure as said above
then i have to insert the values can any one help me

satish

Tibor Karaszi

2006-03-06, 7:23 am

It is recommended to never do SELECT * or INSERT without column list in production code, which makes
that code independent of the order of columns in a table.

Anyhow, no, there is no way to change column order in a table without re-creating the table.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www. solidqualitylearning
.com/

Blog: http:// solidqualitylearning
.com/blogs/tibor/



"satish" <satishkumar.gourabathina@gmail.com> wrote in message
news:1141642885.735134.249180@i39g2000cwa.googlegroups.com...
> hi,
> my doubt is --can u swap the columns of the table
> ie..,
> create table dd(f int ,e int ,g int)
> table structure ;
>
> f e g
> 1 2 4
>
> now i want the columns to be swaped as : e f g
>
> i know i can get the answer by using a select statement
> select e,f,g from dd
>
> but i want to get the table struncture as as e f g
> when i write --------- select * from dd
> i have to get the structure as said above
> then i have to insert the values can any one help me
>
> satish
>


satish

2006-03-06, 7:23 am

thanking you for clarifyig my doubt ----- i think at the design state
of the data base or table structure -more information to be collected


thanks
satish

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com