Home
Certification Preparation
Microsoft
SQL Server exams
Anyone familiar with using Choose with a list?
N2IT
All the examples of Choose seems to reference a position ranking followed by the list (predefined). Can you build a date list for example and then reference the date list with choose? When I try to use choose on a date list it pulls back all the fields in the list.
Right now I am using a max sub select to reference the same table to create a dynamic max query to pull the latest date range. I was hoping choose could do this. Thanks!
Find more posts tagged with
Comments
NotHackingYou
I think you could use CHOOSE(
@Pos
, 'Date1','Date2',Date3') ?
N2IT
I was hoping to reference the list
choose(2,'DateList')
A predefined list seems rather limited like for days of the week or months in a year. I was hoping you could nest an expression with choose to create a function.
I tried casting the datelist to varchar and some other techniques. It reminds me of the choose in excel and just a limited
NotHackingYou
I can't seem to get CHOOSE to work with a subquery. You may have to make a UDF or SP that when called queries a table and builds up your params based on the # of results.
N2IT
It seems to be very limited. O well I am moving on enough about CHOOSE lol.
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Best Of