Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2008
    Posts
    6

    Unanswered: Change the name of a column

    I need to change the name of a column of a populated table.

    How could I do this without dropping, re-creating and re-populating the table?

    Which is the statement?

    Thank you!
    Gabriele

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12

  3. #3
    Join Date
    Jun 2008
    Posts
    6
    It is ok. Thank you.

    Gab

  4. #4
    Join Date
    Oct 2008
    Posts
    9
    sp_rename [ @objname = ] 'object_name' ,
    [ @newname = ] 'new_name'
    [ , [ @objtype = ] 'object_type' ]

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Ummm, thanks for copy and pasting from the posted link, invaluable contribution.
    George
    Home | Blog

  6. #6
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    not to mention I am not sure the object type is still relevant when renaming a column. I was renaming some columns in 2005 and it errored until I removed the COLUMN argument. I did not look into as why it was erroring cuz I am lazy.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

Posting Permissions

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