Auto Headers In SQL Server Query Analyzer in SQL 2014 , SQL 2012 , SQL 2008

How many of are using scripts in text file and when ever there is issue we copy paste the script in query analyzer. But Sql server give us a feature to get all the scripts on query analyzer when ever sql server starts.

And this feature is called auto header,  I must say this is a trick instead a feature of sql server.

So my requirement is to get my scripts in header whenever i start sql server

/*********** Scripts ******************/
Select @@servername
Select 'This is Saurabh sinha Blog '


Check sql server version and architecture (32 bit / 64 bit)

For 32 bit --> Program Files (x86)
Fro 64 bit --> Program Files

1. I have 32 bit so  open below path as per sql version

SQL Server 2014:

C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\SqlWorkbenchProjectItems\Sql

Sql server 2012 :

C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\SqlWorkbenchProjectItems\Sql

Sql server 2008:

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

2. Create a text file on you desktop name "SQLFile.sql" and paste your content in same , save and close it

3. Now replace this SQLFile.sql with your file saved at desktop.

4. No use your option ctrl +N .

And here is your new window

Even If after doing same you are not getting required text open regiedit search for

 "HKEY_USERS\S-1-5-21\Software\Microsoft \Microsoft Sql Server\100\Tools\Shell\FileMRUList"

And make sure it should have location of you SQLfile.sql

No comments:

Post a Comment