Cant transfer table from one schema to another within the same database.

  • Hey there,

    I hope somebody can point me in the right direction. I am trying to do the above using the following...

    ALTER SCHEMA [dbo] TRANSFER [schemaame].[tablename];

    ...but getting the following error...

    Msg 15530, Level 16, State 1, Line 5

    The object with name "tablename" already exists.

    The tablename I see in SSMS is schemaame.Tablename

    When I look at the properties of the table, it says the name is 'tablename'.

    I cant work out how I can change the schema of the table. Also, surely having a \ in a schema name is not recommended, right?

    Thank you for any help and feedback.

    Regards,

    D.

  • Duran (10/7/2015)


    Hey there,

    I hope somebody can point me in the right direction. I am trying to do the above using the following...

    ALTER SCHEMA [dbo] TRANSFER [schemaame].[tablename];

    ...but getting the following error...

    Msg 15530, Level 16, State 1, Line 5

    The object with name "tablename" already exists.

    The tablename I see in SSMS is schemaame.Tablename

    When I look at the properties of the table, it says the name is 'tablename'.

    I cant work out how I can change the schema of the table.

    So [dbo] is the name of the schema you want the object to move to, have you checked the schema to see which tables already exist in this schema?

    Duran (10/7/2015)


    Also, surely having a \ in a schema name is not recommended, right

    You'd think, but I tested it and it doesn't complain like so

    alter schema [dbo] transfer object::[B\ob].[Table_1]

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

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

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