CHOOSE() function in SQL Server Denali

by Amol 22. September 2011 09:30

SQL Server Denali introduces some cool function which makes programming easy. Let's take an example of new function CHOOSE() which is introduced in SQL Server Denali

CHOOSE() fuction will returns a value from a given array of values based on specified Index.

SELECT CHOOSE(MONTH(GETDATE()), 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')

 Above statement will return the Month Name based on Month Number. 

Tags: ,


Tag cloud