Transact-SQL Scripts

Accessing and Changing Relational Data

Accessing and Changing Relational Data

Transact-SQL Scripts

A script is a series of Transact-SQL statements stored in a file. The file can be used as input to SQL Query Analyzer or the osql and isql utilities. The utilities then execute the SQL statements stored in the file.

Transact-SQL scripts have one or more batches. The GO command signals the end of a batch. If a Transact-SQL script does not have any GO commands, it is executed as a single batch.

Transact-SQL scripts can be used to:

  • Keep a permanent copy of the steps used to create and populate the databases on your server (a backup mechanism).

  • Transfer the statements from one computer to another, when necessary.

  • Quickly educate new employees by enabling them to find problems in the code, understand the code, or change the code.