Template Explorer in SQL Server 2005

Do you feel tired of knowing or searching for the syntax of doing some tasks like creating database, adding a constraint to a table etc.,?

 

SQL 2005 provides lots of template of doing basic tasks. This tip is for people who do not know about template explorer.

 

Let me provide this TIP with a small example of creating a database (Database only) called Inventory.

 

01) Launch the SQL Server 2005 Management studio

02) Click on Menu Item View=>Template Explorer (Or Ctrl+Alt+T)

03) This will open the Template Explorer on the left or right side pane

04) Have a look at the almost for all the tasks there is a template.

05) For our example, expand the Database folder

06) Double click the create database node

07) Provide the authentication in the displayed dialog to connect to the db

08) You have a template code in the Query Editor Window.

09) Now you need to fill the parameters for the Template before running the Query

10) Look for the Toolbar Icon A=>B, the Tool tip says, “Specify values for template Parameters”. And click on it.

11) The displayed dialog shows all the Template parameter required. Fill in the Value for the database name. Click OK.

12) Have look at the Query in the query editor window. It is now ready to create the database. Execute the Query to finish the task of creating the database.


I have taken a very simple template for this tip. But can try with some other templates. I think this TIP will minimize going web search for the syntax of performing the basic tasks.