Choose() Function
This function returns a value out of a list based on its index number. You can think of it as an array kind of thing. The Index number here starts from 1.
Syntax
CHOOSE ( index, value1, value2.... [, valueN ] )
CHOOSE() Function excepts two parameters,
Index: Index is an integer expression that represents an index into the list of the items. The list index always starts at 1.
Value: List of values of any data type.
Facts related to the Choose Function
The following are some facts related to the Choose Function.
Item index starts from 1
DECLARE @ShowIndex INT;
SET @ShowIndex =5;
Select Choose(@ShowIndex, 'M','N','H','P','T','L','S','H') As ChooseResult
In the preceding example we use index=5. It will start at 1. Choose() returns T as output since T is present at @Index location 5.
Output
This function returns a value out of a list based on its index number. You can think of it as an array kind of thing. The Index number here starts from 1.
Syntax
CHOOSE ( index, value1, value2.... [, valueN ] )
CHOOSE() Function excepts two parameters,
Index: Index is an integer expression that represents an index into the list of the items. The list index always starts at 1.
Value: List of values of any data type.
Facts related to the Choose Function
The following are some facts related to the Choose Function.
Item index starts from 1
DECLARE @ShowIndex INT;
SET @ShowIndex =5;
Select Choose(@ShowIndex, 'M','N','H','P','T','L','S','H') As ChooseResult
In the preceding example we use index=5. It will start at 1. Choose() returns T as output since T is present at @Index location 5.
Output
Sign up here with your email
ConversionConversion EmoticonEmoticon