T-SQL Scripts included with Management Studio

Have you ever wanted to quickly script T-SQL code to add columns to a table, alter a partition function, create endpoints, configure data capture, create an indexed view, backup or restore databases?  These tasks and more are included as templates.  The template explorer is included in SQL Server 2005 and SQL Server 2008 Management Studio (SSMS).   To view the template explorer hit Ctrl+Alt+T or select Template Explorer from the view menu in SSMS.  You will find templates 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 Compact 3.5 SP1.


Once you load a template in the editor section in SSMS you can specify values for the template parameters values.  Press CTRL+Shift+M to specify values as shown on the next figure.

The templates are placed in the users Documents and Settings folder under Application Data\Microsoft\Microsoft SQL Server\100\Tools\Shell\Templates. Templates are available for solutions, projects, and various types of code editors as they are scripted as individual sql files.

  • Hi, Congratulations to the site owner for this marvelous work you’ve done. It has lots of useful and interesting data.