SQL Complete - SQL Code Formatter for SQL Management Studio

Contents

Introduction

One of the most useful features of SQL Complete is SQL code formatter used for beautifying SQL and T-SQL statements straight in a SQL document in SQL Server Management Studio. The difference between our SQL formatter for SSMS and other formatters is possibility to customize the way your document will be formatted by setting the corresponding options and possibility to preview the result.

Note that there are two editions of SQL Complete - Express and Standard. SQL Complete Express has free SQL formatter with limited capabilities and SQL Complete Standard brings you all power of the SQL code formatting feature.

What will I get with SQL formatter?

Your SQL code will look pretty and be easier to read, understand, debug, and test.

Your productivity will be increased and you'll save a lot of time, as you will no longer have to worry about SQL query formatting when creating, reformatting it, or making modifications.

You can introduce unified SQL code formatting standard for your company, no matter if it is a big enterprise or a small project team.

How does our SQL beautifier work?

Before SQL code is formatted, the formatter checks SQL code syntax and creates a parsing tree for each SQL. At last, it performs SQL formatting basing on the parsing tree. If there are any syntax errors in the SQL document that is being formatted, the inner parser will not generate the parsing tree and the document will not be formatted. It's also worth mentioning that statements are loaded to the memory as they are analyzed in the document on its opening or on inserting code from buffer into an empty document. And that's why the formatter will not require much memory even if a SQL document is large. We've tested the formatter's work with a 130MB SQL document.

SQL Code Formatter - Formatted SQL Document

Why formatter does not format all statements?

If SQL Complete does not format all statements or any specific statements, the reason can be one of the following:

If you have the Express edition of SQL Complete, then you should keep in mind that it supports formatting only of such DML statements as SELECT, UPDATE, DELETE, INSERT. Other statements, such as DDL, T-SQL, will be ignored and an error message will be shown.

SQL Code Formatter - Express Edition Warning

Note that only the Standard edition of SQL Complete provides support for formatting of any SQL statements.

If some expression contains a syntax error. In this case the formatter will ignore this statement and show an error message in the Output window.

SQL Code Formatter - Syntax Error

In this case you will have to correct the error in your script and format the document once more.

An option for some specific statement may be turned off. Check the corresponding option's state in the options window using SQL CompleteOptionsFormatter in the SSMS top menu.

Conclusion

dbForge SQL Complete provides you not only Intellisense, but also offers capabilities for customizable SQL query formatting. With the comprehensive SQL code formatter available in SQL Complete, you will be able to format SQL query and beautify SQL code.

SQL Complete: smart autocomplete for SQL Server developers & DBAs