开发者

Customise default 'New Stored Procedure' SSMS 2008 Template

I am trying to customise the default query which is put in place when you cli开发者_如何学Cck 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... ?


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


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.


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


For SSMS 18 the file is located here:

C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\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:

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!!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜