Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Guest Editorial: In Praise of Templates

By Phil Factor,

I'm a 'plain-screen' man, by preference. On occasion, when I'm doing database development work I can, and do, dispense with Management Studio (SSMS) altogether. "Point 'n click" is OK for ad-hoc work, but it soon becomes drudgery. However, there are a few wonderful features of SSMS that keep me hanging on in with it, chief among them being templates.

They seem to be SSMS's best-kept secret but, when you've got to do some complicated admin jobs to do, the templates are a godsend. Just open up the template explorer (Control-Alt-T), and find the template you want. Double-clicking on the template will open it up in a new query window, or you can simply "drag 'n drop" the template into an existing query window. Hit Control-Shift-M and up pops a screen, inviting you to fill in the values of any parameter (alternatively, on the Query menu, click "Specify Values for Template Parameters". Having done that, you have working code for your particular requirement. You can even drop templates into your favourite programmer's text editor, although you'd have to write an add-in script to present you with a dialog box to fill in the parameters like the one you see when you hit Control-Shift-M in SSMS.

What happens if the template you want isn't there? You can create your own one simply by right-clicking on the appropriate folder in Template Explorer, and selecting New | template). You can also modify the ones that SSMS itself uses when someone uses the object explorer to create a new object. You probably like your documentation headers for your object creation scripts formatted in the 'house style', so doing this will save you a lot of tedium. Also you've written your various generic views or tables types, or even complex database components, that you use again and again, Save these as templates, maybe with parameters, and then suddenly you've got productivity sewn up.

Despite all this, Microsoft gives every impression of having abandoned the implementation of Templates half way through, when some shinier bead rolled into view. As such, there are a few shortcomings. For example, there is no way of loading templates from a shared directory, or placing any new templates into source control. Team-sharing of templates is almost impossible.

Nevertheless, templates are a major reason to like SSMS and you're missing out on some productivity gains if you're not using them.

Total article views: 259 | Views in the last 30 days: 1
Related Articles

Passing Parameters Between ReportViewers Controls

Passing Parameters Between ReportViewers Controls on two Seprate Pages


Controlling the size of a report that is launched from click action of a previous report

Controlling the size of a report that is launched from click action of a previous report


Using Templates

Templates are one of those really handy tools that most DBAs I know of have either never heard of or...


ReportViewer (web control) - parameter change refresh

ReportViewer (web control) - parameter change refresh


T-SQL Tricks – Customizing SSMS Templates with Parameters

I wrote briefly about templates in Management Studio (SSMS), and showed the default templates that c...


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones