Customise default 'New Stored Procedure' SSMS 2008 Template

£可爱£侵袭症+ 提交于 2021-02-17 14:46:47

问题


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


回答1:


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:

  • Alter
  • Create Basic
  • Create with Cursor
  • Create with Output
  • Create from New Menu
  • Drop

Edit as you like!

For SQL Server 2012,

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




回答2:


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.




回答3:


For anyone interested, the files for SQL Server 2014 x64 are at:

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




回答4:


For SSMS 18 the file is located here:

C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\SqlWorkbenchProjectItems\Sql\Stored Procedure




回答5:


Seems there are TWO separated sets of scripts installing SQL SMO 2005: At the beginning they are usual, but think about this:

First set, is where p.campbell said (C:\Program Files\Microsoft SQL Server\100\ etc) but the template used when you open the template manager are in C:\docs & settings\myuser etc; and this is quite logical: I don't want to find my collegues' customizations in my templates!.

I think that if you want to use a template "automatically" (right click, "create procedure") the template in c:\program... will be used while if you use the template manager, YOUR copy will be used instead.

PS: Thanks to all spending some of their time to help others!!



来源:https://stackoverflow.com/questions/3180649/customise-default-new-stored-procedure-ssms-2008-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!