locked
re-ordering columns RRS feed

  • Question

  • I know that the columns in a relational database theoretically have no order. But, the reality is that once there are more than about a score of columns it is nice for the development team to be able to put the columns in a specified order in order to find them easily.

    Is this posible in SQL Server 2005 without recreating the entire table (as the designer does)?

    Thursday, April 29, 2010 5:59 PM

Answers

  • No, the only way is to re-create. Alternatively you can create a view with only subset of columns.
    Premature optimization is the root of all evil in programming. (c) by Donald Knuth

    Naomi Nosonovsky, Sr. Programmer-Analyst

    My blog
    • Proposed as answer by Sedat Salman Thursday, April 29, 2010 6:04 PM
    • Marked as answer by Jacob Wagner Thursday, April 29, 2010 6:07 PM
    Thursday, April 29, 2010 6:01 PM

All replies

  • No, the only way is to re-create. Alternatively you can create a view with only subset of columns.
    Premature optimization is the root of all evil in programming. (c) by Donald Knuth

    Naomi Nosonovsky, Sr. Programmer-Analyst

    My blog
    • Proposed as answer by Sedat Salman Thursday, April 29, 2010 6:04 PM
    • Marked as answer by Jacob Wagner Thursday, April 29, 2010 6:07 PM
    Thursday, April 29, 2010 6:01 PM
  • SSMS also re-create it .

    if you want to do easily without work with SQL

    you could use management studio


    http://www.sdtslmn.com
    Thursday, April 29, 2010 6:06 PM
  • ya, I use management studio now but table rebuilds cant be done in a production environment without interrupting service. I was hoping to find annother way.

    Tnahks all

    Jacob

    Thursday, April 29, 2010 6:08 PM
  • you had to work a lot for this.

    you could add columns at the order that you needed

    copy the values with update drop references and recreate new ones

    drop the old columns

     

    that the only way i know


    http://www.sdtslmn.com
    Thursday, April 29, 2010 6:14 PM