Wednesday, May 28, 2008

[itsdifferent] Re: Comma separated list of values of single Database table field

Of course one can do it... but when you require this kind of information programatically you need to iterate through records. In that case he'll have to use some piece of program using loop constructs like cursors (in case of T-SQL) or if he prefer he can do it by iterating in ADO.Net dataset also.


--- In, "Brijesh" <brijesh.pandya@...> wrote:
> I would have just copied single column output in a text editor and did
> a newline V/s Comma replacement.
> --- In, "sudev_gandhi" sudev.gandhi@
> wrote:
> >
> > Many times you need to create a comma seperated list of values in a
> > table. Here is a line of T-SQL solution to get comma separated list of
> > values of single field of a database table.
> > DECLARE @commaSeparatedVal AS VARCHAR(MAX);
> >
> > SELECT @commaSeparatedVal = ISNULL(@commaSeparatedVal +',','') +
> >
> > PRINT @commaSeparatedVal
> >
> > Regards,
> > Sudev Gandhi
> > [Recent Articles On My Blog] <>
> >

Note: This Group is not a Job Searching Group, so please co-operate and dont transfer any kind of job related material across this Group.AnyOne doing so can be banned from the Group
Thanx , Group Co-Ordinators
Need traffic?

Drive customers

With search ads

on Yahoo!

John McEnroe

on Yahoo! Groups

Join him for the

10 Day Challenge.

Yahoo! Groups

Special K Challenge

Join others who

are losing pounds.



No comments: