Do you have a comment or suggestion to improve SQL Server? We’d love to hear it!

T-SQL for changing table column order

Once a table is created, the ordinal position of the columns is fixed. This is especially problematic for large data warehouse tables, where new columns are expected to be added over time.

The only solution currently to re-order columns is to drop and recreate the table (or let the SSMS designer do this for you), but this is often not feasible for a large, highly used table, and it cannot be easily scripted.

Please add some ALTER syntax that will allow changing column order.

6 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Steve shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Steven Hibble commented  ·   ·  Flag as inappropriate

        Although this would be a nice-to-have metadata operation, I think the workaround is probably all you need. Give your table a view. Select the columns in the order that you want.

      Feedback and Knowledge Base