![sql code formatter sql code formatter](https://i.imgur.com/QP9hDwz.jpg)
These make less intrusive changes, but these changes do alter the query text. This article is about the lightweight refactoring actions. These require a separate window or wizard to accomplish and won't be discussed in this article. It can perform heavyweight refactoring processes, such as renaming objects, splitting tables, or encapsulating code as a stored procedure.
![sql code formatter sql code formatter](https://jennifergalas.com/images/code/xml_upload.gif)
SQL Prompt offers several different categories of refactoring for SQL objects and code. Refactoring changes alter the text of the query without affecting the meaning of the code. Having set that style as active, we apply those style options to the selected code using Format SQL ( Ctrl K, Y). We save our preferred formatting options as a code formatting style.
![sql code formatter sql code formatter](https://beta.lazyketo.app/uploads/1531181190bang-bang-sauce-1.jpg)
If we were to remove all formatting from a piece of code, it would continue to function exactly as before. We lay out all the clauses, expressions, lists, parentheses, and so on in our code by adding or removing carriage returns, linefeeds, tabs, and spaces. Refactoring in SQL Promptīy running the Format SQL command when laying out code using SQL Prompt, we can apply two distinct types of changes to the code: formatting and refactoring.įormatting changes are purely decorative they affect only whitespace. Although these actions can run as part of Format SQL, they extend beyond the scope of formatting since they change the actual text of the query without changing the meaning or intent of the query. These actions are designed to help improve the overall quality of your SQL code in various subtle but meaningful ways, such as qualifying object names, standardizing the use of aliases, adding semicolons to the end of statements, and removing unnecessary square brackets around object names. In this article, I'll discuss how I use the SQL Prompt actions that you can apply as part of the Format SQL command.