CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2005
    Posts
    1,030

    Is it possible to add a column in any position?

    If I use,
    Code:
    alter table [tableName] add [column] [type]
    Then the new column will be added at the end. I wonder if it is possible in SQL server to add a new column in any position? Thanks.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Is it possible to add a column in any position?

    Victor Nijegorodov

  3. #3
    Join Date
    Jul 2005
    Posts
    1,030

    Re: Is it possible to add a column in any position?

    But the ways you referred to require me to drop the table and re-create the table with the desired order. But my question is actually if I can add a new column in any position without dropping/re-creating the table? Thanks.

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Is it possible to add a column in any position?

    Quote Originally Posted by LarryChen View Post
    ... But my question is actually if I can add a new column in any position without dropping/re-creating the table?
    Well, my answer is "No, you cannot."

    However, my answer could be wrong if you would find some option to add a new column in the specified position in the MSDN documentation for ALTER TABLE
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured