Yesterday when I was about to leave office , I got a call from one of my friend. He wanted to know how to write a recursive query?I said use Template Explorer, Where you can get examples for recursive query but He was unaware of this feature of SQL server. So I thought to write on this.
SQL server provides number of templates which can be used to Create, Alter and Drop different database objects like Table, Index, Triggers, View and many more. With the help of Template Explorer you can do DDL operation on object as well as you can learn How to write recursive query too.
Follow below steps to open the recursive query example:
Step 1- Open SQL Server Management Studio
Step 2 – Use shortcut key Ctrl + Alt + T or You can find this option under View-> Template Explorer
Step 3: Expand Recursive Queries section
We can create our own Custom Template, Refer How to create custom template?
When first time the template explorer is opened, a copy of the templates are placed in the user’s folder in C:\Users, under <username>\AppData\Roaming\Microsoft\SQL Server Management Studio\11.0\Templates. So that all users can have their own copy of templates.