简体   繁体   English

自定义默认的“新存储过程”SSMS 2008模板

[英]Customise default 'New Stored Procedure' SSMS 2008 Template

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. 我正在尝试自定义从SQL Server Management Studio 2008上的Object Explorer单击“ New Stored Procedure...时所使用的默认查询。

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. 我已经找到了如何从Template Explorer更改“创建存储过程(新菜单)”模板,但这意味着我将不得不继续打开模板资源管理器而不是像我通常那样点击新的存储过程。

How can I edit the template which appears when you click New Stored Procedure... ? 如何编辑单击“ New Stored Procedure... ”时出现的模板?

For SQL Server 2008, find this directory : 对于SQL Server 2008,找到此目录:

C:\\Program Files\\Microsoft SQL Server\\100\\Tools\\Binn\\VSShell\\Common7\\IDE\\SqlWorkbenchProjectItems\\Sql\\Stored Procedure\\

or for those on x64 Windows, 或者对于x64 Windows上的用户,

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

Within are 6 .sql files: 内有6个.sql文件:

  • Alter 改变
  • Create Basic 创建基本
  • Create with Cursor 使用光标创建
  • Create with Output 使用输出创建
  • Create from New Menu 从新菜单创建
  • Drop 下降

Edit as you like! 随你编辑!

For SQL Server 2012 , 对于SQL Server 2012

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

Works for SSMS 2005 and 2008: 为SSMS 2005和2008工作:

In the menu click View/Template Explorer (or Ctrl-Alt-T) 在菜单中单击查看/模板资源管理器(或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. 右键单击并在弹出菜单中选择“编辑”以直接更改文件。

对于任何感兴趣的人,SQL Server 2014 x64的文件位于:

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

Seems there are TWO separated sets of scripts installing SQL SMO 2005 : At the beginning they are usual, but think about this: 似乎安装SQL SMO 2005有两组独立的脚本:一开始它们很常见,但请想一想:

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; 第一集是p.campbell所说的( C:\\Program Files\\Microsoft SQL Server\\100\\ etc),但打开模板管理器时使用的模板位于C:\\docs & settings\\myuser等; 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. 我认为如果你想“自动”使用模板(右击,“创建程序”),将使用c:\\program ...中的模板,如果你使用模板管理器,则会使用你的副本。

PS: Thanks to all spending some of their time to help others!! PS:感谢大家花一些时间来帮助别人!

对于SSMS 18,文件位于:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM