SQL Server Mgmt Studio Templates

March 6, 2010 by Chris · Leave a Comment 

Here’s a little feature that has been shown to me multiple times over the years. Every time I see it I get all excited by the possibilities — then (sadly) quickly forget it. This time I hope that by writing it down I’ll remember longer… Enjoy the pictures!

It turns out that SQL Server Management Studio has a nifty little option to speed up many, if not most, database tasks. Just find the Template Explorer under the View menu:
(note: my understanding is this is the same for 2005 and 2008 versions. The pictures below are from 2005)

Template Explorer

This opens a new panel on the right side of SSMS (by default). Tons of tasks are listed. For instance, suppose you want to create a new table. Drill down to it and then double-click.

Template Explorer

That leads to the template opened in a new SQL editor window.

SQL Editor with Template

But look at all those angle brackets. We’re not done quite yet. In the past I would start editing all those to replace my own values manually. Today Chris Randall showed me a better way while on a bit of a “side trip” during a test prep session.

Under the Query menu, select “Specify Values for Template Parameters…”

Menu option for Template parameters

Now you get this slick little dialog. Set your values, click OK and you have a script ready to go.

Template Parameters Dialog

Great tip, huh?

Check out the template list sometime, it is huge! I’m sure it is documented somewhere… but I couldn’t find a full list of all the stuff it holds.

Possibly Related posts:

  1. SQL Server in the Cloud
  2. Learned a bit about SQL Server Full Text Search
  3. Tiny Wi-Fi rant, New Meebo feature and SQL Server observation
  4. One Week Full of SQL Server DTS Development
  5. Visual Studio Express Tools Updated

Comments

Leave a Reply

  • About

    Wandering the Internet, looking at all things bright and shiny. Playing with many, writing about some. More...
  • Referrals and Ads

    Mozy Logo for Referral

    Dropbox Logo for Referral

    Dreamhost Promotion
    Get $50 off at Dreamhost — Just mention SOLOTECH50 when signing up!

  • Topics

  • Flair and Sparklies