Templates for New Query Window

  • Comments 4

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>

Leave a Comment
  • Please add 7 and 5 and type the answer here:
  • Post
  • Never mind the last comment.  On x64 boxes, it's located at

    "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\SqlWorkbenchProjectItems\Sql".

  • OK, now another change. :) For SQL Server 2012, I found it on my system here: "C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\SqlWorkbenchProjectItems\Sql"

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

  • 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.

Page 1 of 1 (4 items)