I have a FooDb database with a BarSchema schema that contains a Tbl table (i.e. FooDb.BarSchema.Tbl )
I also registered as a user with BarSchema by default.
This query works fine
SELECT * FROM FooDb..Tbl
I also have a synonym for this table in another db
CREATE SYNONYM TblSynonym FOR FooDb..Tbl
But now I get the error "Invalid object name" FooDb..Tbl " on execution
SELECT * FROM TblSynonym
If I changed the synonym to
CREATE SYNONYM TblSynonym FOR FooDb.BarSchema.Tbl
It works great.
Why doesn't the default syntax scheme work?
(The background is that I am collecting data from several databases, all of which have the same table names but different schema names. It would be much easier if I could set the default schema for each database for the user, and then ignore it everywhere in the script)
source share