sp_rename - ERROR

  • Hi Folks,

    I tried to rename a column using 'sp_rename' procedure throwing the following error.

    USE MyDB;

    GO

    EXEC sp_rename

    @objname ='Schema_Name.Table_Name.Old_Column_Name',

    @newname = 'New_Column_Name',

    @objtype ='COLUMN';

    GO

    Msg 15248, Level 11, State 1, Procedure sp_rename, Line 240

    Either the parameter @objname is ambiguous or the claimed @objtype (COLUMN) is wrong.

    But if I use the SSMS designer to rename the column, it works fine.

    Any one had this issue.

    Thanks!

  • I would like to recall this post. I was running under wrong database.

  • SQL!$@w$0ME (7/12/2016)


    I would like to recall this post. I was running under wrong database.

    Don't worry about removing it;-)

    😎

    Suggest you look into colour coding the connections in SSMS and paying attention to which database you are connected to, adding SELECT DB_NAME() at the start of the query might help

  • Thanks!

  • sp_RENAME 'dbo.AllocationDetails.[[Conversion_Fee]]]' , 'Conversion_Fee', 'COLUMN'

Viewing 5 posts - 1 through 4 (of 4 total)

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