需要一个工具来自动缩进和格式化 SQL Server 存储过程
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/686394/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Need a tool to automatically indent and format SQL Server stored procedures
提问by Malik Daud Ahmad Khokhar
In my current project I've been inherited with lots of long (1200+ lines) SQL Server stored procedures with some horrible indentation and formatting which makes them almost unreadable. Is there some tool that I can use to automatically format these and make them more readable? I don't want to go through it manually and indent it.
在我当前的项目中,我继承了很多很长(1200 多行)的 SQL Server 存储过程,这些存储过程带有一些可怕的缩进和格式,这使得它们几乎不可读。是否有一些工具可以用来自动格式化这些内容并使它们更具可读性?我不想手动通过它并缩进它。
回答by mwigdahl
Here's a couple -- no idea how well they work, unfortunately...
这是一对——不幸的是,不知道它们的效果如何……
http://www.wangz.net/gsqlparser/sqlpp/sqlformat.htm(free)
http://www.wangz.net/gsqlparser/sqlpp/sqlformat.htm(免费)
http://www.sqlinform.com/(free for personal use)
http://www.sqlinform.com/(个人免费使用)
回答by Kenneth Hampton
Try using ApexSQL Refactor. It integrates into SSMS and it's a free tool. Good thing about it is that it allows to save formatting options and share them with the team so all of you use the same settings for code.
尝试使用ApexSQL Refactor。它集成到 SSMS 中,是一个免费工具。它的好处是它允许保存格式选项并与团队共享它们,因此你们所有人都使用相同的代码设置。
回答by Jamie Ide
Try redgate SQLPrompt. It has a 14-day trial.
尝试redgate SQLPrompt。它有 14 天的试用期。
回答by gbn
Red Gate "SQL Refactor"Very good. We bought it
红门“SQL 重构”非常好。我们买了
Or
或者
SSMS tools packFree, but we don't use the layout features
SSMS 工具包免费,但我们不使用布局功能
回答by J.W.
Check out Sql assist:
查看 Sql 帮助:
It has some format feature.
它有一些格式功能。
http://www.roundpolygons.com/Default.aspx?PageContentID=5&tabid=92
http://www.roundpolygons.com/Default.aspx?PageContentID=5&tabid=92
I would suggest downloading the evaluation version to see whether it fits your need.
我建议下载评估版,看看它是否适合您的需要。
回答by J.W.
Try www.softfrontiers.com/Downloads/ReIndenter.shtml Free (or donate) and download.
试试 www.softfrontiers.com/Downloads/ReIndenter.shtml 免费(或捐赠)并下载。
Works on C# and SQL Server code.
适用于 C# 和 SQL Server 代码。
Is very fast and doesn't change the code except for indentation and endblock comments where missing and possible.
速度非常快,并且不会更改代码,除了缺少和可能的缩进和结束块注释。
回答by kishore varma
I am using the following link to format and indend your SQL Server Code online. http://sqlserverlearner.com/online-tools/tsql-code-formatter
我正在使用以下链接对您的 SQL Server 代码进行在线格式化和索引。http://sqlserverlearner.com/online-tools/tsql-code-formatter
Its working great!!
它的工作很棒!!
回答by Jersey Dude
I have been using dbForge SQL Complete for a while now and am pleased with it($99 and free version). The formatter works from within Visual Studio and SMSS. It also has a handy code completion feature that works better the the standard one built into SMSS.
http://www.devart.com/dbforge/sql/sqlcomplete/ordering.html
我已经使用 dbForge SQL Complete 一段时间了,对它很满意(99 美元和免费版)。格式化程序在 Visual Studio 和 SMSS 中工作。它还有一个方便的代码完成功能,比 SMSS 中内置的标准功能更好。
http://www.devart.com/dbforge/sql/sqlcomplete/ordering.html