Transact-SQL Reference (Database Engine)


THIS TOPIC APPLIES TO: yesSQL Server (starting with 2008)yesAzure SQL DatabaseyesAzure SQL Data Warehouse yesParallel Data Warehouse

Transact-SQL is central to using SQL Server. All applications that communicate with an instance of SQL Server do so by sending Transact-SQL statements to the server, regardless of the user interface of the application.

The following is a list of the kinds of applications that can generate Transact-SQL:

  • General office productivity applications.

  • Applications that use a graphical user interface (GUI) to let users select the tables and columns from which they want to see data.

  • Applications that use general language sentences to determine what data a user wants to see.

  • Line of business applications that store their data in SQL Server databases. These applications can include both applications written by vendors and applications written in-house.

  • Transact-SQL scripts that are run by using utilities such as sqlcmd.

  • Applications created by using development systems such as Microsoft Visual C++, Microsoft Visual Basic, or Microsoft Visual J++ that use database APIs such as ADO, OLE DB, and ODBC.

  • Web pages that extract data from SQL Server databases.

  • Distributed database systems from which data from SQL Server is replicated to various databases, or distributed queries are executed.

  • Data warehouses in which data is extracted from online transaction processing (OLTP) systems and summarized for decision-support analysis.

To view the Transact-SQL reference topics

To view the list of topics in the Transact-SQL reference section of SQL Server Books Online, follow these steps:

  1. On the SQL Server Books Online toolbar, click the Sync with Table Of Contents button.

  2. On the Contents tab, expand Transact-SQL Reference.

System_CAPS_ICON_note.jpg Note

When viewing this content in the MSDN Library, use the Table of Contents to browse for topics or search for commands by name.

For a list of Transact-SQL functions by category, see Built-in Functions (Transact-SQL).

For a short tutorial about how to write Transact-SQL, see Tutorial: Writing Transact-SQL Statements.

For help with Transact-SQL statements, see MSDN Transact-SQL Forum.

The Transact-SQL reference includes topics related to SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, SQL Server 2014, and Azure SQL Database. Near the top of each topic is a section indicating which products support the subject of the topic. If a product is omitted, then the feature described by the topic is not available in that product. For example, availability groups were introduced in SQL Server 2012. The CREATE AVAILABILTY GROUP topic indicates it applies to SQL Server (SQL Server 2012 through current version) because it does not apply to SQL Server 2008, SQL Server 2008 R2, or Azure SQL Database.

In some cases, the general subject of topic can be used in a product, but all of the arguments are not supported. For example, contained database users were introduced in SQL Server 2012. The CREATE USER statement can be used in any SQL Server product, however the WITH PASSWORD syntax cannot be used with older versions. In this case, additional Applies to sections are inserted into the appropriate argument descriptions in the body of the topic.

Transact-SQL Syntax Conventions (Transact-SQL)
SQL Server Database Engine

Community Additions