Wednesday, May 28, 2008

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

I Normally use Regular Expressions, however this depends on where you
want the presentation layer, on Business Module / Database or in the
actual presentation.

thanks

--- In itsdifferent@yahoogroups.com, "sudev_gandhi" <sudev.gandhi@...>
wrote:
>
>
> 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 itsdifferent@yahoogroups.com, "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 itsdifferent@yahoogroups.com, "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 +',','') +
> > > CONVERT(VARCHAR,[SKU]) FROM PRODUCT
> > >
> > > PRINT @commaSeparatedVal
> > >
> > > Regards,
> > > Sudev Gandhi
> > > [Recent Articles On My Blog] <http://sudev.blogspot.com/>
> > >
> >
>

__._,_.___
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
Y! Messenger

Files to share?

Send up to 1GB of

files in an IM.

New web site?

Drive traffic now.

Get your business

on Yahoo! search.

Special K Group

on Yahoo! Groups

Join the challenge

and lose weight.

.

__,_._,___

No comments: