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
 SQL Server Development (2000)
 Distinct Select

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-04-12 : 09:29:13
Graham writes "I have a db that contains a column named DSCODES. Values in DSCODES are seperated by a comma.

If I run the following command.

select distinct(DSCODES) from DB

The following is returned.

S100,S102,S103
S100,S103,S105

What I would like returned is the following

S100
S102
S103
S105

Is this possible?

Thank you in advance

Graham"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-04-12 : 09:30:44
Try this:

http://www.sqlteam.com/item.asp?ItemID=2652

Other related articles here:

http://www.sqlteam.com/searchresults.asp?SearchTerms=csv

And I know someone wrote a UDF that can do the same thing, but I can't remember where I saw it. Hopefully someone will remember and post it.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-04-13 : 00:51:22
make use of CSVTable() here



KH


Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-04-13 : 03:32:03
>>"I have a db that contains a column named DSCODES. Values in DSCODES are seperated by a comma.

Read about Normalisation
http://www.datamodel.org/NormalizationRules.html

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -