- What's instant sql formatter?
- How does this sql beautifier work?
- What can I do when my SQL is not formatted?
- Does this formatter support unicode?
- Why copy to clipboard button doesn't work in firefox?
- May I setup this sql formatter on my site?
- I don't want to post my sql on internet, how do I tidy my sql?
- Output of SQL formatter
- Formatter Options
Instant SQL Formatter is a free online sql tidy tool, actually, it not only can beautify your sql but also can turn your formatted sql into html code, so you can post coloured sql code in your blog, forum,wiki and any website easily. In addition to beautifying SQL code, this sql tool can translate SQL code into C#, Java, PHP, DELPHI and other program languages. Another useful feature is find out all database objects such as table, column, function in sql by selecting output format to list database object.
Many conventional sql formatting tools use ad hoc string processing methods to implement the formatting process. This can work pretty well for many sample sqls. But it often fails when multiple statements per line, nested comments, comments around incomplete blocks of code or keywords, etc. are encountered, as they always are in large systems of software. The result of such failure is badly formatted sql query, or worse, sql text that is no longer is acceptable to the database.
SQL Pretty Printer(Instant sql formatter) parse the sql query according to the sql dialect lexical and syntax rules. This ensures that the syntax structures found match those of the corresponding sql dialect, and enables a more flexible and accurate layout control. As a result, a more user friendly formatted sql will be generated.
If there are syntax errors in the SQL, the internal parser will not generate the parse tree, so SQL will not be formatted.(Since Ver3.0, if you set output type to keeplayout, output still can be generated, and you still can modify case, remove comment, and generate text, html, rtf output)
SQL Pretty Printer supports DB2, MySQL, MS Access, MS SQL Server(T-SQL) and Oracle including PLSQL.
1. Choose the right database before formatting SQL. SQL syntax varies between databases. To get the best formated SQL output for each database, General SQL Parser uses a different internal parsing routine for each corresponding database. Therefore, it's important to choose the right database before formatting.
2. When you input multiple SQLs, make sure each SQL is separated by a semicolon, especially when you choose Oracle database .
3. Fix the syntax errors reported by formatter and re-format.
4. You can select output format to "html keep layout" this will generate colored html SQL code.
5. If your SQL is error free and still can't be formatted, please send your sql to us if possible, we will fix this bug and inform you as soon as possible.
No. Linux version supports iso-8859-1 character set which works fine for most sql. You can have a try of SQL Pretty Printer desktop version or Add-In for SQL Server Management studio that support unicode. And the sql parse engine behind this sql formatter tool support unicode as well.
Yes. Please contact us for more information.
There is a desktop version of this sql formatter, the desktop version has more features, and it's faster and earier to use. There is also an Add-On version for Visual Studio and an Add-On for SQL Server Management Studio.
Output of SQL formatter
Output beautified sql in html code makes sql more readable by adding color to sql, and it's easy for you to deploy your coloured html sql code to other website. There are 2 kinds of html output, one is html(span), includes style sheet. the other is html(font), this output is useful if website doens't allow you to post html code with style sheet tag.
Beautified sql is in plain text format, can be copied to any editors for further processing.
Sometimes, you don't want to change layout of your input sql, just want to change case of keyword, identifier or functions. OR, just want to turn your sql into html code to post in blog, forum, and wiki, then this output format is what you need.
If you want to include sql code in your program, then this feature can save you a lot of time. Instant SQL Formatter can turn sql code into Java, C#, Php, VB, Delphi, VC. Take this sql for example: select f1,f2 from t1, output code can be used in java is like this.It can save you lots of time to generate this code by hand if sql is large.
StringBuffer var1 = new StringBuffer(); var1.append("SELECT f1, "); var1.append(" f2 "); var1.append("FROM t1");
Instant SQL Formatter is powered by General SQL Parser which has a powerful sql engine that can process sql of different databases such as Oracle, SQL Server, DB2 and MySQL. Once sql was analyzed, a parse tree for this sql was created, lots of useful information can be fetched from this parse tree, get information about database object such as table, column, function, index is what "List database object" output do.
Whole structure of sql parse tree was saved in XML format for your further processing.
Before tidy sql, instant sql formatter will remove linebreak of input sql. Here is an example for you, When get sql from Oracle V$sqltext, usually, you get sql like this, So you need check this option that make this sql formatted correctly.
If you sql code was taken from program, and close by " or ', then you may check this option, and set quoted char of eachline to corresponding char before beautify sql.
If you want to make input sql to a single line sql, then this option is what you need. Just check this option, and set Max length per line in compact mode to a large number such as 9999.