Templates for New Query Window

When I’m in SQL Server Management Studio and I click the “New Query” button, my Query Window comes up like this:

/* <ScriptFileName, SYSNAME, ScriptFileName>.sql

Purpose: <Purpose, SYSNAME, Purpose>

Author: <Author, SYSNAME, Buck Woody>

Last Edited: <LastEdited, SYSNAME, LastEdited>

Instructions: <Instructions, SYSNAME, Instructions>





/* End <ScriptFileName, SYSNAME, ScriptFileName>.sql */

Then I just press CTRL-SHIFT-M and enter the name of the script file, the purpose and so on.

I was recently asked how I have that come up every time.

Just locate the file called Sqlfile.SQL. It’s normally in:

C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\SqlWorkbenchProjectItems\Sql

And edit it to have whatever you want. If you want the replaceable parameters like I have, just put whatever you want in this format:

<ParameterName, ParameterType, DefaultValue>

Comments (4)
  1. DaleH says:

    Never mind the last comment.  On x64 boxes, it's located at

    "C:Program Files (x86)Microsoft SQL Server100ToolsBinnVSShellCommon7IDESqlWorkbenchProjectItemsSql".

  2. Buck Woody says:

    OK, now another change. :) For SQL Server 2012, I found it on my system here: "C:Program Files (x86)Microsoft SQL Server110ToolsBinnManagementStudioSqlWorkbenchProjectItemsSql"

  3. Pauli says:

    Brilliant, thanks Buck, just what I was looking for!

  4. James says:

    Thanks for the pointer! Just an FYI: this does not affect the default template used in the Object Explorer's right-click "New Query" menu.

Comments are closed.

Skip to main content