Share via


Overview of Transact-SQL Editor

You can author, validate, and execute Transact-SQL (T-SQL) scripts and queries in the T-SQL editor. You can also use the editor to modify definitions of database objects such as tables, views, indexes, stored procedures, and so on. The T-SQL editor is your primary way to author scripts that run before and after you deploy a database. The T-SQL editor provides the same basic functionality as the code editors for Visual C# or Visual Basic.

Features of the T-SQL editor include the following:

  • All common features for Visual Studio editors, which include find and replace, bookmarks, block indent and un-indent, integration with the Visual Studio Error List window, and block commenting and un-commenting.

  • Support for shortcut keys compatible with other editors and SQL Server Management Studio.

  • SQL syntax coloration for different versions of Transact-SQL (for Microsoft SQL Server 2005 and SQL Server 2000) to improve readability and make the creation of complex statements easier.

  • Validation of SQL syntax without executing the script or query.

  • Ability to edit while disconnected.

  • Multiple sets of query results, displayed either as a grid, as text, or saved to a file on disk.

  • Collection and display of client statistics when you run queries.

  • Ability to execute multiple queries in one editor instance, with multiple result sets generated. The queries are executed sequentially.

  • Ability to execute multiple queries at the same time in different editor instances.

  • Configurable settings for executing query

  • Support for SQLCMD

Database Sessions and Connections

You can have multiple instances of the T-SQL editor open at the same time. You can execute scripts or queries at the same time in the different sessions. This approach is useful if you have multiple, long-running queries, such as re-indexing operations.

In an individual T-SQL editor instance, you can work while connected or disconnected. However, you can always edit scripts and queries but you cannot validate or execute queries if you do not have a connection to a database. Without closing your session, you can change databases or connect to a different server.

The same T-SQL editor is used when you open a database object from Schema View or the file that contains that object from Solution Explorer. When you modify a database object, you are editing the underlying .sql file. To update the database on the server, you must build and deploy your changes.

See Also

Tasks

Walkthrough: Create and Execute a Simple Transact-SQL Script
How to: Modify Database Objects

Concepts

Terminology Overview of Team Edition for Database Professionals

Other Resources

Transact-SQL Editing Essentials
Managing Database Connections within the Transact-SQL Editor
Script Analysis and Execution in the Transact-SQL Editor