FAQ

General

What's instant sql formatter?

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.

How does this sql beautifier work?

Before the SQL is reformatted, the SQL formatter first checks the syntax of the input SQL, then creates a parse tree for each SQL. Finally, it formats your SQL based on the parse tree. If there are syntax errors in the SQL, the internal parser will not generate the parse tree, so SQL will not be formatted. This SQL formatter is based on the General SQL Parser which supports the entry level of ANSI SQL99. It also supports most common SQL of DB2, MySQL, MS Access, MS SQL Server and Oracle including PLSQL, so most SQL dialects of these databases can be formatted.

What can I do when my SQL is not formatted?

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. 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.

Does this formatter support unicode?

No. Linux version supports iso-8859-1 character set which works fine for most sql. Windows version support unicode. And the sql parse engine behind this sql formatter tool support unicode as well.

Why copy to clipboard button doesn't work in firefox?

Mozilla based browsers such as firefox will ask the user for permission before allowing instant sql formatter to access the clipboard, so you need to enable javascript copy to clipboard function like this: In the address bar, type "about:config" and press Enter. Scroll down to the signed.applets.codebase_principal_support option. If it is not already set to true, double-click it to change it to true.

May I setup this sql formatter on my site?

Yes. Please contact us for more information.

I don't want to post my sql on internet, how do I tidy my sql?

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

Html output

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.

Plain text output

Beautified sql is in plain text format, can be copied to any editors for further processing.

Output keep layout

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.

Output to other programming languge

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");
        				

List database object

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.

XML output

Whole structure of sql parse tree was saved in XML format for your further processing.

Formatter Options

Are there more format options?

Yes, Please check desktop version, Add-On version for Visual Studio and Add-On for SQL Server Management Studio., And there are more than 100 format options in SQL Pretty Printer Pro.

What does "remove line break before beautify sql" means?

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.

What does "trim quote char of each line" means?

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.

What does compact mode means?

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.