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
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 Change Ordinal Position

Author  Topic 

sirmilt
Starting Member

49 Posts

Posted - 2012-01-26 : 12:25:45
I am using SQL Server 2008 R2 Express with the SSMS. a number of columns. I tried to find a method in the Help files, but they were no help.

Is there any way to move the columns around without cutting and pasting?

Milt

sirmilt
Starting Member

49 Posts

Posted - 2012-01-26 : 12:28:55
Sorry, I found the answer. I simply drag the field to the new position. The answer is so simple i never thought of it until after my post.

Milt
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-01-26 : 12:33:50
Keep in mind that this will drop and re-create the table behind the scenes. You cannot change column positions using ALTER TABLE, you can only ADD columns after existing ones, or DROP columns.

A column's ordinal position in a table should never matter, you should always specify columns in SELECT and INSERT statements and you can order them any way you like.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2012-01-26 : 13:31:07
"A column's ordinal position in a table should never matter,"

Indeed so, but I much prefer to have "related columns" ordinally-adjacent in the schema so that when picking them from lists (in GUIs like SSMS) they are logically-grouped
Go to Top of Page
   

- Advertisement -