Problems with multiple SQL Server schema objects

I have a database with several schemas and objects below them. I want to combine objects into one circuit.

I tried

ALTER SCHEMA dbo TRANSFER <custom_schema>.<table_name> 

I get the message "existing object". However, I do not see him in the management studio and

 SELECT * from dbo.<table_name> 

returns an error "object does not exist".

It seems that some record in the system table is not working. I looked at sysobjects and it has only one entry. Any suggestions for troubleshooting / fixing this issue are welcome.

Note. I can create a synonym

 CREATE SYNONYM dbo.<table_name> FOR <custom_schema>.<table_name> 

works great

+4
source share
1 answer

According to this MSDN page, your problem may be caused by a duplicate primary key name . those. the primary key name table_name conflicts with the primary key name that is already defined in some other table in dbo.

To fix this problem, rename the primary key for the table that you want to move. Use a name that does not appear as a primary key in the destination schema.

+8
source

All Articles