The Auto-replacement feature allows to replace any text previously specified with the appropriate keyword, object name or any kind of SQL code. Using the Auto-replacement feature, 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, go to the ApexSQL main menu → ApexSQL Complete and click the Enable auto-replacement command:
All auto-replacement items can be accessed through the Manage auto-replacements window, which can be initiated from the same menu:
Any of the existing auto-replacement items can edited or deleted, or new ones can be created.
To create a new one, in the Replace field, specify the string that need 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 SQL code, right-click on an object in Object Explorer or Server Explorer, and from the ApexSQL Complete menu, select the Assign auto-replacement option:
The Auto-replacement window appears offering the string that needs to be replaced with an object name in the Replace field:
When the specified string is typed, 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. A new auto-replacements can be created without enabling the feature, thus it needs to be enabled 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. The Replacements are saved in the Replacements.xml file located in:
Q: Is there a way to edit/add auto-replacements outside of SQL Server management Studio?
A: Yes. All replacements can be edited, and add new ones by modifying the content of the Replacements.xml file located in: