Using SQL Server Management Studio Templates

Templates are boilerplate files containing SQL scripts that help you create objects in the database. Microsoft SQL Server 2005 provides a variety of templates. The first time the template explorer is opened, a copy of the templates is placed in the users Documents and Settings folder under Application Data\Microsoft\Microsoft SQL Server\90\Tools\Shell\Templates. Templates are available for solutions, projects, and various types of code editors. Templates are available to create objects such as databases, tables, views, indexes, stored procedures, triggers, statistics, and functions. In addition, there are templates that help you to manage your server by creating extended properties, linked servers, logins, roles, users, and templates for Analysis Services, and SQL Server 2005 Compact Edition.

The template scripts provided with SQL Server Management Studio contain parameters to help you customize the code. Template parameter definitions use this format <parameter_name, data_type, value>, where:

  • parameter_name is the name of the parameter in the script.
  • data_type is the data type of the parameter.
  • value is the value that is to replace every occurrence of the parameter in the script.

Use the Replace Template Parameters dialog box to insert values into the script.

Create custom templates for tasks you perform frequently. Organize your custom scripts into the existing folders or create a new folder structure.

See Also

Other Resources

How to: Use Templates in SQL Server Management Studio

Help and Information

Getting SQL Server 2005 Assistance