I have several tables with defined owner user in a SQL Server 2008 database
a_user.[table1]
a_user.[table2]
When I log in as admin I cannot query either table because it doesn't exist [in that user namespace].
How can I make admin开发者_运维问答 or any other user be able to query table a_user.[table1] without referencing the user?
select * from a_user.table1 --> works
select * from table1 --> doesn't work, i'd like this to work
What you're looking at are schemas, not owners. The two concepts are distinct (from SQL Server 2005 onwards).
To resolve any table name, SQL Server will look in your default schema. By default, this will be dbo. The only way to access a table without specifying a schema name is for it to be in your default schema, or for you to add a synonym for the table within your default schema.
精彩评论