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)
 Converting comma seperated string value into rows

Author  Topic 

hnomani
Starting Member

35 Posts

Posted - 2005-08-17 : 17:22:58
I am trying to separate a comma separated string into a multiple rows value.

Example:

select 'LUN, NWL, VHI' as String1

to display the result as

String1
LUN
NWL
VHI

The comma separated string is stored in a table and can have multiple values and the query that I am running needs to run based on the values in the string (IN caluse).

Thanks

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2005-08-17 : 17:44:18
The search feature is your friend: http://www.sqlteam.com/searchresults.asp?SearchTerms=CSV

---------------------------
EmeraldCityDomains.com
Go to Top of Page

hnomani
Starting Member

35 Posts

Posted - 2005-08-17 : 18:43:24
Thanks, this will work!

quote:
Originally posted by hnomani

I am trying to separate a comma separated string into a multiple rows value.

Example:

select 'LUN, NWL, VHI' as String1

to display the result as

String1
LUN
NWL
VHI

The comma separated string is stored in a table and can have multiple values and the query that I am running needs to run based on the values in the string (IN caluse).

Thanks


Go to Top of Page
   

- Advertisement -