I am trying to customise the default query which is put in place when you click New Stored Procedure...
from the Object Explorer
on SQL Server Management Studio 2008.
I have found how to change the 'Create Stored Procedure (New Menu)' template from the Template Explorer
, however this means I will have to keep opening the template explorer rather than clicking on new stored procedure like i usually would.
How can I edit the template which appears when you click New Stored Procedure...
?
Use SQL Server Management StudioExpand Stored Procedures, right-click the procedure to modify, and then select Modify. Modify the text of the stored procedure. To test the syntax, on the Query menu, select Parse. To save the modifications to the procedure definition, on the Query menu, select Execute.
Open Template Browser. Right-click SQL Server Templates, and then select New > Folder. Right-click the template you created, and then select Edit.
Templates are boilerplate files containing SQL scripts that help you create objects in a database. The first time the template explorer is opened, a copy of the templates are placed in the user's folder in C:\Users, under AppData\Roaming\Microsoft\SQL Server Management Studio\130\Templates.
SET NOCOUNT ON prevents the sending of DONEINPROC messages to the client for each statement in a stored procedure.
For SQL Server 2008, find this directory :
C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\SqlWorkbenchProjectItems\Sql\Stored Procedure\
or for those on x64 Windows,
C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\SqlWorkbenchProjectItems\Sql\Stored Procedure\
Within are 6 .sql files:
Edit as you like!
For SQL Server 2012,
C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\SqlWorkbenchProjectItems\Sql\Stored Procedure
Works for SSMS 2005 and 2008:
In the menu click View/Template Explorer (or Ctrl-Alt-T)
Within the Template Explorer which opens, find:
Stored Procedure/Create Stored Procedure (New Menu)
Edit: Additional explanation
Right click and choose Edit in the popup menu to alter the file directly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With