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 2008 Forums
 Transact-SQL (2008)
 comma seperated

Author  Topic 

kiranmurali
Yak Posting Veteran

55 Posts

Posted - 2010-10-26 : 06:51:36
Hi,

can any one help me in getting this solved .

i have a column in my table lobid varchar(max)
sample data is 1,3,4,5 like this.

In the view i have to convert this id into name (get this values from master table)i.e.,

the output should be like this (kiran,karthi,lekha,rekha)
for the corresponding id's i have to display name in comma seperated.
can any one help me in solving this..

Thanks in Advance
Kiranmurali

Kristen
Test

22859 Posts

Posted - 2010-10-26 : 06:56:25
Don't store a delimited list in a single column. Create a child-table and store the entries there, one row per value. At the minimum your child table will have columns for ParentTableID and ChildValue.

If you have a delimited list then use a Splitter Function to present them as a table, one-value-per-row. e.g. http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=Best%20split%20functions
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-10-27 : 04:10:45
quote:
Originally posted by kiranmurali

Hi,

can any one help me in getting this solved .

i have a column in my table lobid varchar(max)
sample data is 1,3,4,5 like this.

In the view i have to convert this id into name (get this values from master table)i.e.,

the output should be like this (kiran,karthi,lekha,rekha)
for the corresponding id's i have to display name in comma seperated.
can any one help me in solving this..

Thanks in Advance
Kiranmurali


Read about normalisation. With your currect design you need split as well as concatenation for everything

Madhivanan

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

- Advertisement -