In this article I will show you how to save your custom queries as a template and reuse the queries instead of saving as a file.
- We have a folder structure.
- Easy to Navigate.
- Very flexible and also handy to use.
- It is stored within the SQL so we can reuse easily.
There are many uses of the template explorer in the view menu. A pictorial representation helps more than textual. So here I have described all the steps in the pictorial
Shortcut Key of Template Explorer
CTRL + ALT + T
Step 1: Click the View menu and select Template Explorer.
Step 2: Where the Template Explorer is located within the SQL.
Step 3: List of Options is available when right-clicking folder.
Step 4: Shows the list of templates available as default.
Step 5: How to create folder for template file.
After adding folder, note we can also add Sub folder too.
Step 6: How to rename the folder.
Step 7: How to Add template file within the created folder.
Template file takes the extension .SQL
And after adding the template file:
Step 8: If you need to modify then you need to right-click the template file and click EDIT and then change the query. This also applies to adding extra queries to the existing Template file.
Note: If you double-click the file and modify something and try to save it, it will ask wheteher you want to save as.
Always use EDIT in the Template file to save the changes.
Step 9: After clicking EDIT by right-clicking on the template file, we can add or modify the queries.
After editing the template, just use the shortcut CTRL + S to save the modification within the template file.
Step 10: Adding template file within the sub folder.
Then the next image will be.
Step 11: How to search template folder or template file within the selected folder.
The search result will be.
Step 12: Copying, cutting and also you can delete both template folder and template file.
Thus I have explained how to save your custom queries and reuse it in SQL Server.
Thanks for reading this article.