New Columns

  • I created a couple of new columns in an existing table. These are now located at the bottom in the column list. How do I move these up in the column list so that I can order them logically?

  • If you really want to do this then;

    Go into table designer click on where you want the columns to be displayed and then right-click and select insert column and cut-paste your column into there.

    Be aware thought that this effectively copies the table into a new table so if you have a lot of rows in the table it may take a while or even time-out. Another way to achieve the same results is to create a new table with your desired column order and do a select into to copy the data across.

    Though, it is worth noting that the order of the columns does not mean anything to sql, and it is simply the way they are presented in the GUI, so I would be inclined to leave the columns un-ordered and change the order in your select queries and views if necessary.

  • You aren't going to like it..

    1. Create a new table with the fields in the order you want

    2. Copy data from old table to new

    3. Drop old table

    4. rename new table to old table's name.

    5. Done..

    Coincidently this is pretty close to what SSMS does when you reorder fields from the GUI..

    CEWII

  • I appreciate the replies. I am going to roll with it as is.

    Thanks

  • Excellent choice. I wish more people who ask that question had your good sense. 🙂

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply