I am a little confused right now. Can someone answer me with a simple answer to this question.
I have a user [user_test] and has [db_owner] role assigned to him for one database [database_test].
The user's default schema is [user_test] and almost all objects from the [database_test] are created under schema [user_test]. In the database exist 3 more objects with schema [dbo]
The user has rights to both schemas: [dbo] and [user_test] without explicitly specifying them in select statements in front of objects reference.
What is the first schema checked by SQL when an object is called by user [user_test] ?
I mean, If [user_test] issues a select for an object from dbo schema (without schema in front), will SQL first check in it's default schema specified and then in dbo?
thanks,
Best Answer
With SQL Server 2005 & 2008 the first schema that is searched is the users default schema.
from SQL Server Best Practices – Implementation of Database Object Schemas
and
Default Schema was introduced in SQL Server 2005 Upgrading to SQL Server 2005 and DEFAULT_SCHEMA setting