Using Identifiers As Object Names
The complete name of an object is made up of four identifiers: the server name, database name, schema name, and object name. They appear in the following format:
The server, database, and owner names are known as the qualifiers of the object name. When you refer to an object, you do not have to specify the server, database, and owner. The qualifiers can be omitted by marking their positions with a period. The valid forms of object names include the following:
An object name that specifies all four parts is known as a fully qualified name. Each object that is created in Microsoft SQL Server must have a unique, fully qualified name. For example, there can be two tables named xyz in the same database if they have different owners.
Most object references use three-part names. The default server_name is the local server. The default database_name is the current database of the connection. The default schema_name is the default schema of the user submitting the statement. Unless otherwise configured, the default schema of new users is the dbo schema.
Four-part names are generally used for distributed queries or remote stored procedure calls. They use the following format:
The following table shows the part names and their descriptions.
Name of the linked server that contains the object referenced by the distributed query.
Name of the catalog that contains the object referenced by the distributed query. When querying a SQL Server database, the catalog is the database name.
Name of the schema that contains the object referenced by the distributed query.
Object name or table name.
For distributed queries, the server part of a four-part name refers to a linked server. A linked server is a server name that is defined with sp_addlinkedserver. The linked server identifies an OLE DB provider and an OLE DB data source that can return a record set that Microsoft SQL Server can use as part of a Transact-SQL statement.
To determine what components in the OLE DB data source are used for the catalog and schema parts of the name, see the documentation for the OLE DB provider specified for the linked server. If the linked server is running an instance of SQL Server, the catalog name is the database that contains the object, and the schema is the owner of the object. For more information about four-part names and distributed queries, see Distributed Queries.
For remote procedure calls, the server part of a four-part name refers to a remote server. A remote server, which is specified with sp_addserver, is an instance of SQL Server that is accessed through the local server. Execute stored procedures on the remote server by using the following format for the procedure name:
All four parts of the name are required when you are using a remote stored procedure. For more information about remote servers, see Configuring Remote Servers.
Column names must be unique within a table or view. You can use up to three prefixes to specify columns in a query where more than one table that is referenced may have a column of the same name. Any one of the following formats is acceptable:
Properties of user-defined type columns are referenced by using the period separator (.) between the column name and the property name. When property names are referenced, you can also reference the table or view identifiers, but not the database or schema identifiers. The following formats are acceptable: