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
 Insert a Column at Particular Index()

Author  Topic 

paramu
Posting Yak Master

151 Posts

Posted - 2013-11-20 : 08:30:07
Hi, Iam using SQL Server2012. Is it possible to insert a new_column to table at 10th of it's column_index ?

Ofcourse I can select, but I wish to insert at particular index...Is it possible?

Alter table Table1 add New_Column varchar(20) at 10 ??????

Thanks

Paramu @ PARANTHAMAN

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-11-20 : 08:35:04
we can not...

if you wish to get
1) rename old table ( tab1 to tab2)
2) create table new table with old table name(tab1) and new column at specific column index
3) copy data from tab2 to tab1

--
Chandu
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-11-20 : 08:35:23
Reference
http://blog.sqlauthority.com/2013/03/11/sql-server-how-to-add-column-at-specific-location-in-table/

--
Chandu
Go to Top of Page

paramu
Posting Yak Master

151 Posts

Posted - 2013-11-20 : 08:37:47
Thanks

Paramu @ PARANTHAMAN
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-11-20 : 08:38:59
welcome :)

--
Chandu
Go to Top of Page
   

- Advertisement -