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
 General SQL Server Forums
 New to SQL Server Programming
 how to add column after specified column in sql?

Author  Topic 

subhaoviya
Posting Yak Master

135 Posts

Posted - 2009-11-25 : 01:46:31
for adding column i use

alter tablename add newcolumnname datatype

its getting added as last column only, but i want to add as second column.

how to do this

subha

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-11-25 : 01:57:21
Hi

using query Currently is not possible.

you can use Enterprise Manager or Management Studio to
make this modification (which recreates the table and copies the data,
a pretty dangerous thing to do in a production environment)



-------------------------
R...
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-11-25 : 02:53:51
quote:
Originally posted by subhaoviya

for adding column i use

alter tablename add newcolumnname datatype

its getting added as last column only, but i want to add as second column.

how to do this

subha



Why does the ordinal postion of the column matter?
You can use it at the position you want in the select statement

Madhivanan

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

- Advertisement -