how to change new schema name from existing schema - Table

  • SQL Galaxy

    One Orange Chip

    Points: 29255

    Hi,

    I want change schema name on Table.

    hwdata.DesktopSoft_Master

    to change

    dbo.DesktopSoft_Master

    I tried as below

    ALTER SCHEMA HWData TRANSFER dbo.DesktopSoft_Master;

    Error-

    Msg 15530, Level 16, State 1, Line 1

    The object with name "DesktopSoft_Master" already exists.

    Can you give me script for change new schema Object.

    Thanks

  • Lowell

    SSC Guru

    Points: 323463

    that error says the table already exists in the hwdata schema.

    do a quick

    select * from hwdata.DesktopSoft_Master

    select * from dbo.DesktopSoft_Master

    decide which one to keep (say dbo was the "good one"

    then drop table hwdata.DesktopSoft_Master

    and try to transfer again.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • This was removed by the editor as SPAM

  • clin27

    Grasshopper

    Points: 11

    There are no such object in the destination schema, must be something else.

    • This reply was modified 2 weeks, 2 days ago by  clin27.
  • ScottPletcher

    SSC Guru

    Points: 98559

    ALTER SCHEMA [dbo] TRANSFER HWData.DesktopSoft_Master;

    SQL DBA,SQL Server MVP(07, 08, 09) Prosecutor James Blackburn, in closing argument in the Fatal Vision murders trial: "If in the future, you should cry a tear, cry one for them [the murder victims]. If in the future, you should say a prayer, say one for them. And if in the future, you should light a candle, light one for them."

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

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