views:

127

answers:

4

Are there any lightweight tools that allow easy-to-read crafting of SQL independently of the main apps/utilities associated with a particular database?

I lately find myself working with MySQL, Access & now MS-SQL and use Notepad++ to build queries as it provides basic syntax highlighting that helps my unfamiliar eyes, but no logic formatting - new lines for INNER JOIN, WHERE etc., indenting of continuing parameters, dare I say it even IntelliSense - that kind of thing.

Particularly when re-jigging an existing query that is presented as an incomprehensible lump, it would be nice to be able to paste this in somewhere, click a button and have it displayed in a more human-friendly format.

Does such a tool exist?

Edit: Thanks for the suggestions. In particular, SQLinForm has the kind of fine-grained control I was ideally imagining.

Pity only the online version is free, an OSS standalone app (not Java - gumph!) would be preferable as SQL is not exactly a main focus of my work and I can't see me swinging even $30 past the bean counters just so I don't get a headache trying to fix their crummy reporting.

Any more?

Edit 2: Oops, seems this has been asked before. I wasn't obviously searching for the right thing when I checked. Searching on the tool names, or via Google, brings up many similar questions - voted to close.

+1  A: 

I used this on in the past to make some ugly sql somewhat readable: http://www.dpriver.com/pp/sqlformat.htm

JohnOpincar
A: 

I have use the oracle SQL Developer for this mainly. But this is not exactly lightweight. The MS-SQL-Server development UI is noce for this too. (I Think they work for different databases too).

Toad is another nice UI for this. (But not lightweight too)

Patrick Cornelissen
+1  A: 

I've used SQLInform in the past with pretty good results - again it formats any SQL you paste in with reasonable accuracy.

Galwegian
A: 

I haven't tried it, but I see there is at least one SQuirreL plugin that mentions formatting. Free / open source / Java. http://www.squirrelsql.org/index.php?page=plugins

update - I tried the basic squirrel formatting and it does work. Not sure if it is configurable to how to shape the query..