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 Server Management Studio Code editor or the sqlcmd and osql 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 do the following:

  • Keep a permanent copy of the steps used to create and populate the databases on your server, as a backup mechanism.
  • Transfer the statements from one computer to another when it is required.
  • Quickly educate new employees by enabling them to find problems in the code, understand the code, or change the code.

See Also

Other Resources

sqlcmd Utility
osql Utility

Help and Information

Getting SQL Server 2005 Assistance