SQL server 2012 introduced a new feature namely “Surrounded With” that can reduce the development time and increase the accuracy level in SQL SERVER.
In the previous version of SQL server (2005 & 2008), if we had to do a customization/development in any procedure/function and add few conditions in it, we had to first insert the condition with BEGIN in a certain place and then had to insert an END at an appropriate place.
If both were placed wrongly, then script would not work properly.
The solution is now available in SQL Server 2012 and it is very simple.
Let me explain it Step by Step.
Step 1 :
Write the code where you need to place “If condition , While condition or Begin End” .
Step 2 :
Select the code and right click and select “Surround With”
Step 3 :
Select the appropriate condition either it is “If condition”,“while condition” or “Begin End”.
Step 4 :
SQL server automatically generate the appropriate code in appropriate place, Now just write the condition and run the code.
Let me know if this technique is helpful for you.
Leave a Reply