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)
 Result set into array

Author  Topic 

gayamantra
Starting Member

5 Posts

Posted - 2004-08-22 : 07:51:34
Hi All,

How can I read a query result set (which are of type varchar) into an array? i.e the result set comprises of just one column and 5 rows and i want to save these into an array to easily extract each row whenever i want to. Hope I have conveyed my idea clearly.

Gayathri

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-08-22 : 08:00:17
well a table is an array if you think of it... but arrays as the C# or VB.Net knows of are not possible as such in sql server...
or do you simply want to put all your column values into a string separated by a delimiter?
in which case:

declare @ColumnList varchar(500)
select @ColumnList = COALESCE(@ColumnList + ';', '') + Col1
from Table1
select @ColumnList

Go with the flow & have fun! Else fight the flow :)
Go to Top of Page
   

- Advertisement -