I have a number of tables in the database that belong to schema FOO, at least I think they do; they appear in the tables listing in SSMS as FOO.tablename, and when I right click on one of them and choose Properties
, FOO appears in the Schema
field, and the hint for the Schema
field at the bottom of the Properties window says "The schema that contains the table".
However, when I try to make FOO the owner of a table, of dbo.MyTable
, say, like so:
exec sp_changeobjectowner MyTable, [FOO]
I get this error:
Database principal or schema 'FOO' does not exist in this database.
Why is my schema being rejected as non-existent? Obviously, I'm not understanding something about schemas in SQL Server.
I believe this database existed in an earlier version of SQL Server and was restored into SQL Server 2017.
I want to move a table not in the schema into the schema so it has the schema prefix.