Friday, February 10, 2012

Comma Separated List On Single Line

Hello,

I need to create a single row of data with comma separated fields like such:

Value1, Value2, Value3, Value 4

How can I achieve this with data from a dataset? I do have some other options, but want to consider this being done within the report itself.

Thanks.

You could make an class library with a function that takes several parameters and concatenates the parameters of this method comma-separated. You can call your function in a report:

http://geekswithblogs.net/davyknuysen/archive/2007/03/26/109901.aspx

|||

Brian,

This is how i do it.. this is my sproc to acheive that

ALTERProcedure [dbo].[rpt_LoanAttriApplied]

@.PlanIdint

AS

BEGIN

Declare @.List varchar(255)

Set @.List=' '

Select @.List= @.List+', '+ los.Name

From LoansAttriApplied laa

InnerJoin LoanOptions loson laa.LoanId= los.LoanId

Where PlanId= @.PlanId

selectRight(@.List,Len(@.List)- 2)

--set @.List = Right(@.List, Len(@.List) - 1)

End

|||

Ok, thanks for both.

No comments:

Post a Comment