tags:

views:

901

answers:

7

So Visual Studio has a command like Format Document [Ctrl+K, Ctrl+D] is there something similar for SQL Management Studio?

If not is there any other product out there, anywhere, that can help with this?

We have hundreds of these we have to go through in a rather short time span, and as it we spend WAY to much time reformatting them due to poor initial formatting quality.

We are using Microsoft SQL 2008.

+4  A: 

You could try SQL Formatter (webbased). I think there was a similar question some time ago.

Edit: Yup, duplicate question.

Node
Thanks. That lead me to the best answer:SQL Refactorhttp://www.red-gate.com/products/SQL_Refactor/index.htm
CJCraft.com
A: 

Well, formatting the code online can be done through http://www.dpriver.com/pp/sqlformat.htm . They also provide an offline version.

Greco
A: 

SQL Assistant has worked very well for me. It is a commercial product (not free), but supports a variety of editors at a (IMO) reasonable price.

MattK
A: 

I think SQL Refactor is going to take care of me:

SQL Refactor

CJCraft.com
for $300, send your code to me and I'll reformat it for you!
TrickyNixon
A: 

Try the tools by Quest Software. See the SQL Navigator/Toad for Oracle and/or Toad for SQL Server.

+3  A: 

There are several tools available. I have found some commercial products to be very good for this:

These two work really well. Then you will find some free tools but none of them worked well for me. :-(

All the commercial products have a trial version. Try them in a VM to see if they work for you or not. They are not cheap so you want to know for sure they work for you.

David Pokluda
A: 

Try the SQL Enlight by Ubitsoft. There also is an online pretty printer.

Ilian