Using unqualified names is easiest when the default database is the only database referred to by an SQL statement. When an SQL statement references tables, views, or other objects from more than one database, unqualified names can apply to only one of those databases.
- The default database.
- Any databases referenced by the SQL statement.
- The login user database for a volatile table by that name.
The search must find the table name in only one of those databases. The system returns the “ambiguous table name” error message if the table name exists in more than one of those databases. The default database does not receive priority over any other database.
Therefore, if you reference more than one database, you must use the fully qualified form for names that are contained in more than one of the databases.
The following syntax shows the fully-qualified form referencing, for example, a table: