What free SQL formatting tools exist? [closed]
Asked Answered
G

6

64

I want to beautify the SQL queries I write.

What free tools exist that allow for SQL query formatting?

Gossoon answered 22/7, 2010 at 14:52 Comment(5)
Similar: stackoverflow.com/questions/627643/sql-formatting-toolAfter
Related: dba.stackexchange.com/questions/11074/sql-query-formatterRieth
Try ApexSQL Refactor. It integrates into SSMS and had 150+ formatting options. Disclaimer: I work for ApexSQL.Punitive
There is now a free online SQL Formatter sqlinform.com/sql_formatter_online.htmlLimpet
Related: Command line SQL formatter or beautifier - Software Recommendations Stack ExchangeWarfeld
F
58

PoorMansTSqlFormatter is a free and open-source online beautifier, with offline an SSMS Add-In, command-line beautifier tool, and Notepad++ plugin.

The project aims to format any T-SQL (2000 or later) script, no matter the length or complexity.

Faggot answered 19/7, 2011 at 10:17 Comment(9)
I am glad I found you! I was looking for something that is FREE, does not 'call home' (online) to watch my queries, is portable and uses my 'feel-home' environment of Notepad++. Thanks heaps!Vamp
there is also a free online Java based formatter sqlinform.comLimpet
@SarjanWebDev, Why would any app call home to watch your queries? That seems totally malicious.Redound
I used it's notepad++ plugin, and it seems to do the trick. Thanks for the pointer.Furcula
I did this: 1. Notepad++ > Plugins menu > Plugin Manager > Show Plugin Manager > Available tab > Poor Man's T-Sql Formatter > Install. 2. Restart Notepad++. 3. Plugins > Poor Man's T-SQL Formatter > Format T-SQL code.Vito
As of today 1Jun2017, it does not yet work in Microsoft SQL Server Management Studio/ SSMS 2016: issue: github.com/TaoK/PoorMansTSqlFormatter/issues/144 , previous usage was like: blog.dancody.me/post/50954275473/…Vito
As of today, July 8, it looks like it will work: github.com/TaoK/PoorMansTSqlFormatter/issues/…Vito
@ManoharReddyPoreddy: No, that issue was about the site being down. Recent versions of SSMS (and VS) are still not supported - but I'm working on it.Faggot
great, looking forward to it. Ideally, everyone should be able to contribute to your beautiful tool, so divide into smaller tasks, and ask for small help. I will certainly help. best of luck.Vito
B
17

T-SQL Tidy (dead link) was a very good online SQL formatter/beautifier.

It had a lot of formatting options. Although it was targeted at T-SQL, it should have worked with most SQL dialects.

Breault answered 22/7, 2010 at 15:21 Comment(2)
It now offers an SSMS add-in that works completely offline. Seems to offer more options than PoorMansTsqlFormatter.Amphimacer
link seems to be broken now. can't seem to find it on the web anymore.Moa
C
6

There is a free online Instant SQL Formatter. The site also sells some other versions (add-in for Visual Studio, for example), but the online version is free.

Cataplexy answered 22/7, 2010 at 23:18 Comment(0)
K
2

Re Christoph's answer:

I was looking for the same in Notepad++ and found a link that gives an idea of how to create your own formatting with macros: Formatting SQL in Notepad++

It seems like it would work, but I'm going to use one of the SSMS Add-ins in the previous answer (less work).

Keirakeiser answered 15/9, 2011 at 1:5 Comment(1)
The gist is using a few (simple) regular expressions to transform a presumed format (single-line SQL, etc.) to another format. It could also be done by a script (e.g., in Perl or Python). It will work in a particular circumstance, but it is not generally applicable.Willhite
A
1

I've always been a fan of Navicat.

Their lite version is free, but it still comes with the SQL Beautifier.

As an added bonus, occasionally you'll find some chinglish hiding in odd places.

Armchair answered 22/7, 2010 at 15:9 Comment(1)
The Lite version no longer includes the SQL Beautifier for free -- it requires you to purchase to enable it.Illstarred
F
0

Sequel Pro if using OS X.

Otherwise, just work out what you need, and then develop your query using your knowledge and use the command line tool (my personal favourite:)).

Fantasia answered 22/7, 2010 at 15:3 Comment(2)
But Sequel Pro is only for MySQL, right?Golem
That is correct @newenglander, Sequel Pro only has support for MySQL; however, Postgresql support is in the works!Weed

© 2022 - 2024 — McMap. All rights reserved.