The Auto-replacement feature allows you to replace any text previously specified with the appropriate keyword, object name or any kind of SQL code. Using the Auto-replacement feature, you can auto-correct common typing errors, add some often used SQL statements, and in that way speed up SQL coding. This article describes how to use the Auto-replacement feature.
To enable the Auto-replacement feature, from the main menu click the Enable auto-replacement option, from the drop down menu:
All auto-replacement items can be accessed through the Manage auto-replacements form, which can be initiated from the same menu:
You can edit or delete any of the existing auto-replacement items, or create new ones.
To create a new one, in the Replace field, specify the string that you want to be replaced with the appropriate code. In the Find section, specify SQL code that will be automatically replaced after the string from the Replace field is typed in the query.
To use database object names in your SQL code, right-click on an object in the Object Explorer pane, and from the ApexSQL Complete menu, select the Assign auto-replacement option:
The Auto-replacement dialog appears offering you to specify the string that you want to be replaced with an object name in the Replace field:
When you type the specified string, and hit one of the insertion keys, it will be auto-replaced with the object name:
When assigning an auto-replacement for an object it is recommended to add a schema to the object name, to qualify it fully
Q: Do I have to enable the feature to create a new auto-replacement item?
A: No, you can create a new auto-replacements without enabling the feature, thus you need to enable it before using the auto-replacement
Q: What is the difference between snippets and auto-replacements?
A: Auto-replacements cannot be accessed from the hint list. The add-in will just replace the text according to the auto-replacement specification. On the other hand, snippets can be accessed from the hint list, and they appear according to the context of a query
Q: Can I move auto-replacements from one machine to another?
A: Yes, replacements are saved in the Replacements.xml file located in: C:\Users\<current_user>\AppData\Local\ApexSQL\ApexSQLComplete
Q: Is there a way to edit/add auto-replacements outside of SQL Server management Studio?
A: Yes, you can edit all replacements, and add new ones by modifying the content of the Replacements.xml file located in: C:\Users\<current_user>\AppData\Local\ApexSQL\ApexSQLComplete