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)
 Declaring Arrays in TSQL

Author  Topic 

kdeconto
Starting Member

5 Posts

Posted - 2002-11-22 : 09:33:09
How do you declare an array in TSQL?
How do you assign a delimited list to it?
How do you parse/manipulate that list later?

If I could get help on any or all of these it would be greatly appreciated. Thanks.

mr_mist
Grunnio

1870 Posts

Posted - 2002-11-22 : 09:40:08
quote:

How do you declare an array in TSQL?
How do you assign a delimited list to it?
How do you parse/manipulate that list later?

If I could get help on any or all of these it would be greatly appreciated. Thanks.





Do a forum search on comma separated lists or CSV.

And read http://www.sqlteam.com/item.asp?ItemID=11499

The concept of an array is not really valid. You're better off thinking in terms of tables.

-------
Moo.
Go to Top of Page

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-11-24 : 17:02:08
1. use a table variable

declare @array table (id int, name nvarchar(50))

2. see mr mist's comments re CSV

3. once your data is in the table variable, use your normal SQL.

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page
   

- Advertisement -