SELECT from list

Last Post 11 Jul 2003 02:48 PM by BAnVA. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
kazmerbn
New Member
New Member

--
11 Jul 2003 02:05 PM
I'm looking for a way to generate a resultset from a fixed list without using a table (or temp table).

basically, something like this

SELECT * FROM {1, 3, 6, 10, 15}

would return:

===
1
3
6
10
15

Any suggestions?
BAnVA
New Member
New Member

--
11 Jul 2003 02:48 PM
Can't really do it with just a delimited string without creating a tabular, user-defined function, but if you just want to generate a rowset from some values without using a table (temp or permanent), you can do the following:

SELECT 1 AS 'MyColumn'
UNION ALL
SELECT 3
UNION ALL
SELECT 6
UNION ALL
SELECT 10
UNION ALL
SELECT 15
You are not authorized to post a reply.

Acceptable Use Policy