Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using
SQL
ALTER TABLE Customer ADD homePhonebck VARCHAR(15) AFTER homePhone



here i want a new column(homePhonebck) in customer table after homePhone column
please help
Posted
Comments
vinayoukuri 23-Jul-13 5:34am    
Whar are you working on mysql or mssql?
[no name] 23-Jul-13 5:39am    
Delete the columns and add them back in in the order you want. Or don't do this at all because it does not matter in the slightest what order the columns are in.
MuhammadUSman1 23-Jul-13 6:16am    
You add in start,between or end it work fine.
so easy way to use is add it and in selection or insertion use as you want using column name.
Member 9848727 23-Jul-13 8:25am    
It is not possible in msSql.. Once the table is created we cant alter the position of the columns in the table

1 solution

It's not possible in direct way!

Indirect way is:
1) Create new table with the same collection of columns plus new one (at specific position),
2) Copy data into new table fro existing table,
3) Remove old table (existing one),
4) Rename new table

Please, use SearchBox (at the top-right corner of this site). This question was asked several times...
how to add column at specific position in sql server[^]
how to add column at a specific position in sql server 2005[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900