I just stumbled on this new exciting feature of SSMS Denali while trying my hands querying on this new environment.
Here is a scenario: You’ve created a query or a logic with multiple lines of SQL statements. Now you want this to be validated by an IF-ELSE condition or iterate it in a WHILE loop. You will move the cursor to the top and make extra spaces for inserting IF/WHILE {condition} BEGIN, go to the Bottom and terminate the condition/loop with END statement.
But if you are on Denali you won’t have to do this and type anything. Just a few mouse click would do for you, let’s see how:
1. Select the SQL statement or logic you want to Surround with, then right click on it, select the “Surround With…” option:
2. Now double click on any 3 of your choice, here I selected the “If” condition:
3. The Editor will automatically write the “IF” syntax for you:
4. You just need to add the condition within brackets as per your requirement.
… nice feature introduced by Microsoft.
No comments:
Post a Comment