I had taken Session on SQL 2008 TSQL Enhancements, SQL 2008 R2 TSQL Enhancements in my earlier roles. This post is to cover TSQL Enhancements in SQL 2012. Online SQL Server Virtual Labs is available in Link. You should give it a try. I have tried couple of exercises for Enhancements in TSQL for SQL Server 2012
- Throw Feature Support in Try-Catch
- IIF - Simplify IF-ELSE Logic
- CHOOSE - Select a value from a list based on index of value
- CONCAT - String Concatenate Feature
Feature addition is Throw keyword is supported to throw exception. This is useful for debugging, You can set throw option to debug. For logging you can use catch option and log errors for production database
Normal Try-Catch Scenario
With Throw Keyword
- Concatenate Column Values, Useful for Results Reporting Purpose
IIF and CHOOSE
- IIF simplifies IF else condition specifying both in a single line
Example - Maximum of 3 numbers
CHOOSE
- Return based on index value specified
Next Post we would cover
- TRY_CONVERT
- Format
No comments:
Post a Comment