June 02, 2012

Choose in SQL 2012

Here I am going to show you a very good example of CHOOSE function, newly introduced in SQL Server 11.0.

Let's take an example, I have a Table having daily temperature records. Take a fake example of January, 2012. I have created a table variable with 31 records and put some rand() values for temperature column.



Now, I have to display temperature status in below manner.












Here I am going to write an query using CHOOSE Function.







Hope,
This example will help you to understand choose function.

1 comment: