How move new column a new location?

  • I use code to add new column:

    alter table order

    add [city] varchar(50)

    How to move new column next to column [state]?

  • First of all why do you want to move the column [City] next to the column [state]?

    The order in which you select items is the order in which they are displayed. For example:

    SELECT [Name], [StreetAddress],[City],[State] is the way they will be returned to the calling routine. So their would be no need to rearrange your table definition.

    If you elaborate on the need for this rearrangement of columns maybe we could be of more assistance.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • I agree with bitbucket, if you can explain why, it may help us determine what you are trying to accomplish.

    When you created the column, had you used SSMS you could have right-clicked on Columns and entered all of the column information there. Before exiting, just click and drag the column where you wish it to be.

    Chris Powell

    George: You're kidding.
    Elroy: Nope.
    George: Then lie to me and say you're kidding.

Viewing 3 posts - 1 through 2 (of 2 total)

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