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.
问题:
回答1:
Here's a couple -- no idea how well they work, unfortunately...
http://www.wangz.net/gsqlparser/sqlpp/sqlformat.htm (free)
http://www.sqlinform.com/ (free for personal use)
回答2:
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.
回答3:
Try redgate SQLPrompt. It has a 14-day trial.
回答4:
Red Gate "SQL Refactor" Very good. We bought it
Or
SSMS tools pack Free, but we don't use the layout features
回答5:
Check out Sql assist:
It has some format feature.
http://www.roundpolygons.com/Default.aspx?PageContentID=5&tabid=92
I would suggest downloading the evaluation version to see whether it fits your need.
回答6:
Try www.softfrontiers.com/Downloads/ReIndenter.shtml Free (or donate) and download.
Works on C# and SQL Server code.
Is very fast and doesn't change the code except for indentation and endblock comments where missing and possible.
回答7:
I am using the following link to format and indend your SQL Server Code online. http://sqlserverlearner.com/online-tools/tsql-code-formatter
Its working great!!
回答8:
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