Transact-SQL Syntax Elements

Transact-SQL has several syntax elements that are used by or influence most statements:

Identifiers
Are the names of objects such as tables, views, columns, databases, and servers.
Data types
Define what type of data can be contained by data objects, such as columns, variables, and parameters. Most Transact-SQL statements do not reference data types explicitly, but the results of most statements are influenced by the interactions between the data types of the objects referenced in the statement.
Functions
Are syntax elements that take zero, one, or more input values and return a scalar value or a tabular set of values. Examples include the SUM function for adding several values, the DATEDIFF function for determining how many units of time separate two dates, the @@SERVERNAME function for getting the name of the server running SQL Server, or the OPENQUERY function for executing a Transact-SQL statement against a remote server and retrieving the result set.
Expressions
Are a unit of syntax that Microsoft® SQL Server™ can resolve to a single value. Examples of expressions include constants, functions that return a single value, a reference to a column, or a variable.
Operators
Work with one or more simple expressions to form a more complex expression. For example, combining the - (negative) operator with the constant 12 results in the constant -12. The * (multiplication) operator in the expression PriceColumn *1.1 increases the price by 10 percent.
Comments
Are pieces of text inserted in Transact-SQL statements or scripts to explain the purpose of the statement. The comments are not executed by SQL Server.
Reserved Keywords
Are words reserved for the use of SQL Server and should not be used for the names of objects in a database.

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.