Unless specified otherwise, all Transact-SQL references to the name of a database object can be a four-part name in the following form:
server_name
.[database_name].[schema_name].object_name
| database_name.[schema_name].object_name
| schema_name.object_name
| object_name
-
server_name
-
Specifies a linked server name or remote server name.
-
database_name
-
Specifies the name of a SQL Server database when the object resides in a local instance of SQL Server. When the object is in a linked server, database_name specifies an OLE DB catalog.
-
schema_name
-
Specifies the name of the schema that contains the object if the object is in a SQL Server database. When the object is in a linked server, schema_name specifies an OLE DB schema name. For more information about schemas, see User-Schema Separation.
-
object_name
-
Refers to the name of the object.
When referencing a specific object, you do not always have to specify the server, database, and schema for the SQL Server Database Engine to identify the object. However, if the object cannot not found, an error is returned.
Note: |
|---|
|
To avoid name resolution errors, we recommend specifying the schema name whenever you specify a schema-scoped object.
|
To omit intermediate nodes, use periods to indicate these positions. The following table shows the valid formats of object names.
|
Object reference format
|
Description
|
|---|
|
server
.
database
.
schema
.
object
|
Four-part name.
|
|
server
.
database
..
object
|
Schema name is omitted.
|
|
server
..
schema
.
object
|
Database name is omitted.
|
|
server
...
object
|
Database and schema name are omitted.
|
|
database
.
schema
.
object
|
Server name is omitted.
|
|
database
..
object
|
Server and schema name are omitted.
|
|
schema
.
object
|
Server and database name are omitted.
|
|
object
|
Server, database, and schema name are omitted.
|