With the next release of ApexSQL Complete – a free SSMS and Visual Studio SQL code complete add-in, a new feature will be introduced – text and SQL code Auto-replacements.
This SQL code complete feature allows the user to define shortcuts consisting of a few characters that will be replaced by larger text / SQL code fragments.
This is useful for one-line commands or T-SQL statement subsets, but it could be used to prevent and fix some typing errors such as “adn” for “and”, ”lse” for “else” “CERATE” for “CREATE”.
The option to disable and enable the auto-replacement feature is accessible via the ApexSQL Complete main menu:
Auto-replacement definitions can be fully customized. This can be done from a separate dialog raised by selecting the Manage auto-replacements command in the main menu:
In the Manage auto-replacements dialog, users can create definitions including the text to be searched for “Find” and the text that will automatically replace it “Replace”
When an auto-replacement substitution is defined, instances of these auto-replacement expressions are automatically replaced by the specified string when you press the space bar.
In this example, when pressing the space bar after typing “sel”, it will be replaced, on the fly, with “SELECT * FROM”:
Sel -> SELECT * FROM
If you are repeating some database object names frequently in your SQL code, you will find the implemented right-click option useful. Right click on the SQL object in the Object Explorer, and select Assign auto-replacement from the ApexSQL Complete context menu:
In the Auto-replacement dialog, you can create your auto-replacement for the selected SQL object in the Replace this text field. The With this text field populates automatically with the name of the SQL Server object. In this particular case, this is the name of the stored procedure:
If needed, auto-replacements created this way can be further edited in the Manage auto-replacements dialog.
The text auto replacement feature of this Free SSMS and VS add-in, will make SQL coding faster and database development less error prone.
June 17, 2013