Template Explorer — Stop Retyping CREATE Statements
Open it with Ctrl+Alt+T, or View → Template Explorer. It's a tree of ready-made T-SQL scripts, organized by category — database, table, index, trigger, stored procedure, SQL Server Agent job, linked server, and more — each one a starting point instead of a blank query window.
What makes them more than a snippet library is the placeholder syntax: <parameter_name, data_type, default_value>. A template drops these placeholders wherever a real value belongs:
CREATE TABLE <table_name, sysname, table_1>
(
<column_name, sysname, column_1> <data_type_for_column, , int>
)
Open the template, then press Ctrl+Shift+M (or Query → Specify Values for Template Parameters). One dialog lists every placeholder in the script; fill each in once and every occurrence gets replaced together — no hunting through the script for the second and third place a name needs to change.
.sql files and drop your own in directly). A rollout script you run every time you provision a new database — file groups, standard permissions, an audit table — becomes a template with your own placeholders exactly the same way the built-in ones work.
"Pretty Code" — What SSMS Actually Formats (and What It Doesn't)
SSMS has real formatting commands under Edit → Advanced — Format Document and Format Selection, inherited from the underlying Visual Studio shell, bound to Ctrl+K, Ctrl+D and Ctrl+K, Ctrl+F. They're real, and they're worth knowing about.
SELECT list onto separate lines, align your JOIN conditions, or make a nested subquery readable. If that's what you're after, that's the territory of a dedicated formatter (SQL Prompt, Poor Man's T-SQL Formatter, and similar tools) — SSMS's native command was never built to do that job.
Two commands that punch above their weight, both chords under Edit → Advanced:
- Ctrl+Shift+U — uppercase the selection. Select every keyword you just typed lowercase and fix the casing in one shot, instead of retyping.
- Ctrl+U — lowercase the selection. Same idea, the other direction — handy for taming a script that came in from somewhere with
SELECTandselectmixed throughout. - Ctrl+K, Ctrl+C — comment out the selection (prefixes every selected line with
--); Ctrl+K, Ctrl+U reverses it.
Block/Column Edit — Type Once, Apply to Every Line
Hold Alt and drag with the mouse, or hold Alt+Shift and use the arrow keys, and the selection becomes a rectangle instead of a run of text — a column or box selection. Type, and the same character lands on every selected line at once. Press Delete, and it deletes from every line at once.
The case that sells it: a list of table names, pasted from somewhere else, that all need a schema prefix.
Orders
Customers
Invoices
Products
Put the cursor at the very start of the first line, hold Alt+Shift, press Down three times to select a zero-width column spanning all four lines, then type dbo.:
dbo.Orders
dbo.Customers
dbo.Invoices
dbo.Products
One insertion, four lines updated. The same trick removes a common prefix, indents a block by a fixed number of spaces, or turns a plain list into a DROP TABLE script line by line.
Where Each One Actually Saves Time
| Feature | Best for | Shortcut |
|---|---|---|
| Template Explorer | Starting a DDL/admin script from a consistent, parameterized skeleton instead of a blank window or your memory | Ctrl+Alt+T · fill values with Ctrl+Shift+M |
| Format Document/Selection | Whitespace/indentation cleanup, and fixing keyword casing across a whole script in one pass | Ctrl+K,D / Ctrl+Shift+U |
| Block/column edit | The same small edit repeated down a list of lines — prefixes, indentation, turning a list into statements | Alt+drag or Alt+Shift+arrows |
Best Practices
- ☐ Turn a script you write from scratch more than twice a year into a template — the parameter dialog is faster than editing the same three names by hand every time.
- ☐ Don't expect Format Document to fix a genuinely messy script — it's a whitespace pass, not a rewrite. Reach for a dedicated formatter if that's the actual job.
- ☐ Use Ctrl+Shift+U/Ctrl+U to fix keyword casing before committing a script somewhere it'll be reviewed — cheap, and it reads like it was written carefully.
- ☐ Reach for block edit before a find/replace with a regex you'll have to think twice about — for anything that's really "the same edit, one per line," it's faster and there's nothing to get wrong.
- ☐ Remember Alt+Shift+End the first time a column selection looks "cut off" on shorter lines — it's not a bug, the fix is one more keystroke.
The Bottom Line
None of these three replace a real tool built for the job — Template Explorer isn't a scaffolding generator, Format Document isn't SQL Prompt, and block edit isn't a scripting language. What they are is already installed, already free, and already three keystrokes away the next time a script starts from nothing, needs its casing fixed, or turns into the same one-line edit repeated down a list.