Lets talk about format and refactoring SQL code directly in VS and SSMS without paying a dime 🙂
Expand wildcards, qualify objects, and encapsulate SQL, among others options. Moreover, ApexSql Refactor is able to highlight and locate unused variables and parameters as in the case where a table contains dormant data.
Ok, no can cover better all the options of the tool, so we will present just major perks,we encourage you to go to their Solution Center and read a LOT about code refactoring and different approaches to problems. (With or without their tools)
So, what makes this SQL Refactor tool differ from others?
You want to improve readability, consistency and standardisation of SQL formatting?
Refactor tool offers you consistent code layouts that can enable developers to easily define and share SQL coding standards. Another important feature of the tool is the explicit coding it offers, where you can clean up messy SQL codes and eliminate ambiguous references by fully qualifying object names and replacing the wildcards with clear names.
Risk free SQL code refactoring:
This means that you can automatically update all database objects that are dependent upon changing columns and parameters or renaming the objects. It also automatically highlights and cleans redundant variables while typing.
You can use the tool to streamline your database by replacing 1-many relationships with associative tables. For instance, in one-to-many relationships, one table with one relationship is associated with another table with many relationships. A good example could be a table that holds a product and another table with users’ product reviews referring to one product. In this case, you will need to create a column that will allow you to use a foreign key. Usage of some third party SQL formatter can greatly ease this process.
Also it has ability to convert SQL into different types of programming and it is able to encapsulate length SQL blocks into database objects.
Long story short:
ApexSQLrefactor helpsyou to consistently improve the readability of the SQL database. You can easily define and share the SQL coding standards with other collaborators on the same code and maintain order amongst angry developers :).
One screenshot from their blog showing main menu and integration in SSMS:
Tool is completely free so it’s worth a shot if you are in SQL world. Here is the link to their free tools page:http://www.apexsql.com/free/ . There two more free tools on this page, Complete & Search and you will have to register to be able to download but zero spam so far 🙂
There are few others on market, like Toad for SQL Server by Quest Software and SQL Promt from Red Gate, which is paid.