alter table add column at specific position in sql server

edx
edx
54 Points
17 Posts

Is it possible to add a column to a table at a specific ordinal position in SQL Server?

For instance, our tables always have CreatedDate, CreatedBy, LastModifiedDate, LastModifiedBy columns at the "end" of each table definition? I'd like the new column to show up in SSMS above these columns.

Views: 8433
Total Answered: 1
Total Marked As Answer: 1
Posted On: 11-Jun-2017 21:50

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
Moderator
1172 Points
211 Posts
         

Unfortunately you can't.

If you really want them in that order you'll have to create a new table with the columns in that order and copy data. Or rename columns etc. There is no easy way.

Posted On: 13-Jun-2017 22:19
 Log In to Chat