Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Create a recordset from strings

Author  Topic 

leahsmart
Posting Yak Master

133 Posts

Posted - 2004-07-12 : 11:03:09
Hi Reader.

I have a page that I use to list drop down lists. I get the data for these lists from my database. The data for one of the lists is not in the database. Is there anyway to write a select statement which will create a recordset using strings?

For example:

Select 'A' as Label,
'B' as Label,
'C' as Label,
1 as Data,
2 as Data,
2 as Data

What I want is two fields with 3 rows. I do not want 6 fields with 1 row. Is there anyway to do this?

This is what I want...

Label Data
----------------
A 1
B 2
C 3

Thanks

Leah

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2004-07-12 : 11:19:53
Select Label='A', Data=1
Union All Select Label='B', Data=2
Union All Select Label='C', Data=2



Corey
Go to Top of Page

leahsmart
Posting Yak Master

133 Posts

Posted - 2004-07-12 : 11:24:53
Brilliant!

Your a star!

Go to Top of Page
   

- Advertisement -