开发者

Change default template in SQL Server Management Studio

Is it possible to change the default templates in SQL Server Management Stud开发者_如何学Cio? For example, when I right-click on a table and I choose "Script Table as" from the context menu, I can choose select, insert, update, etc. I would like to change the format of some of these sql scripts like you can with the templates in the template explorer.


'Tis possible only in Tools -> Options -> SQL Server Object Explorer -> Scripting


I know this is a bit late (only five years or so), but in case anyone else stumbles upon this question:

You can go to View -> Template Explorer (Ctrl + Alt + T in SQL Server 2012) and edit the text of all the various templates that SQL uses (including for new Stored Procedures). This is much easier than tracking them down in their Windows directory. You can also add your own templates there, including giving them template parameters to be filled in later (such as <Procedure_Name, sysname, ProcedureName>).

You could use the above to edit the default template when clicking New -> Stored Procedure, but sadly it doesn't look as if you can reassign which template is the default (at least, I've been unable to find a way).


For more control than tools -> options, apparently there are bunch of templates that you can change in the application directory (i.e. : C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\sqlworkbenchprojectitems\Sql), however I couldn't find the ones for basic DML (INSERT, UPDATE etc).

Maybe just the ones for creating new objects are available.


If you are looking to do DROP and CREATE statements in the same script, or otherwise generate scripts for SQL Server 2005 that are more compatible with SQL Server 2000 scripts, you mey want to check out the Scriptio tool:

http://www.codeplex.com/scriptio/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜