Insert a new column in between two columns in SQL Table

Hello Experts,
In a SQL table, is there a way to insert a new column in between two columns?  I don't like to add it at the end.

Thank you very much in advance!
RadhaKrishnaKiJayaAsked:
Who is Participating?
 
Russ SuterCommented:
Using SSMS, yes although behind the scenes it's actually dropping and recreating things. Strictly using query syntax, no it's not possible. You'd have to create a copy of the table with the columns in the order you want then transfer the data from the old table to the new one then drop the old table.
0
 
Russ SuterCommented:
Using SSMS, right click on the table and choose "Design" from the context menu. Next, select the column where you want to insert the new column and right click. Choose "Insert Column" from that context menu. Name the column, set its data type and whether or not you want to allow null values. Save the table and there you go.
Image-1.png
1
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
Columns are always inserted at the end of the column list by default.
Anyway, why the physical order of the columns matters to you?
You can always present the results in the order you want by providing the column names in the SELECT command. Example:
SELECT Column1, Column4, Column2, Column3
FROM TableName

Open in new window

0
 
RadhaKrishnaKiJayaAuthor Commented:
Thank you Russ Suter and Vitor Montalvão.  Your comments are very helpful.  Thank you again!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.