Appendix A

T-SQL Command Syntax Reference

SQL Server 2012 recognizes up to four parts of object names. This convention is the same in SQL Server 2005, 2008, and 2008 R2. Depending on the context of an expression, some parts may or may not be necessary when referencing an object. When a script runs on a different server or when you are using a different database, related object names may be required. Note that versions of SQL Server since 2005 recognize the schema name in the third position, whereas SQL Server 2000 and earlier versions recognized the object owner name in the third position. Table A.1 summarizes the valid syntax for referencing database objects.

Table A.1

Object Reference Use and Context
object Used in the context of the local database, on the same server. object is part of the dbo schema. There are no duplicate object names.
schema.object Used in the context of the local database, on the same server. Duplicate object names that have schema names (and, subsequently, different owners) are permitted. Also uses a standard convention for clarity.
database..object Used in the context of the same or different database on the same server. If you haven't specified the owner or schema, assumes the dbo schema.
database.schema.object A three-part name fully describes an object on the same server, in the same or a different database.
server.database.schema.object A four-part name is valid in the context of a remote server or the local server, in the local or a different ...

Get Professional Microsoft SQL Server 2012 Reporting Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.