SQL Server – Management Studio Tip: Get a customized New Query Window

Hi Friends,

Whenever I click on ‘New Query’ in SQL Server Management Studio, I get the New Query Window, but a customized one. See below:




You can see that “Copyright 2011 – Amit Bansal’ comes by default whenever I click on New Query. In a recent conference, one of the attendees observed this and asked me how can he customize the new query window. Well here is the trick:

Modify SQLFile.sql which is located in C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\SqlWorkbenchProjectItems\Sql. And you are done. This path is for 64 bit installations. Just remove the (x86) for 32-bit installations. Or search for the file 😉

Edit the file in any editor (I use Notepad, my fav editor), put any default comment that you want to be there whenever you create a New Query. And you are done !




About Amit Bansal

Amit Bansal is always brainstorming around SQL Server. Despite working with SQL since 1997, he is amazed that he keeps learning new things every single day. SQL Server is AB's first love, and his wife does not mind that. He tries to share as much and spreads the SQL goodness. Internals and Performance Tuning excites him, and also gives him sleepless nights at times, simply because he is not a genius, but quite a hard worker and does not give up. It has been a long and exciting journey since 1997, you can read here: http://sqlmaestros.com/amit-bansal/ He is on Twitter: https://www.twitter.com/A_Bansal

View all posts by Amit Bansal →

13 Comments on “SQL Server – Management Studio Tip: Get a customized New Query Window”

  1. Good to see many of you liking these tips.. I shall try to post more such tricks/tips. Thanks agin for reading our content at sqlservergeeks.com

    Cheers !

  2. hi . nice.

    but i want 3 line code and my cursor should at last new line.

    how can i do it.

    let me know.

    thank in advanced

  3. Just wanted to say thank you for this – has been invaluable for almost a year. I put my most commonly used tables together in a select, all commented out. Huge shortcut.

  4. Hi,

    I am junior sql dba with one year experince, could you please help me?

    when we opene ssms it gives a connection string and we press connect it gets connect, could you help me how it gets connected, is there any file it is checking, or any protocol it is using to check, could you please explain me in detail what exactly is happening when we press connect?



  5. Lee, in SQL Server 2012, this file is at C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\SqlWorkbenchProjectItems\Sql. Enjoy, thanks.

  6. This works for the New Query button on the toolbar, but if I right-click on a database and choose New Query from the context menu, I still get an empty single line file. Can you say how to customize this way to a new query rather than the toolbar button? Thanks.

Leave a Reply

Your email address will not be published.