Search

Thursday, September 1, 2011

SQL Server Denali : Choose() Function


Choose() function returns an input argument from a list of input values at the desired index which is specified as an input arguement as well.
Syntax: CHOOSE (index, arg1, arg2 [, argN])
The first input argument to the Choose() function is "index" and it is in integer data type. The input arguments can be thought as an array with index starting from 1.
Example:
select choose (1,'a','b','c','d')
It will return 'a'.
If no Value exist at the specified index than it will return null.
select choose (5,'a','b','c','d')
It will return null.

No comments:

Post a Comment