Wednesday, May 28, 2008

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

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

__._,_.___
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
New business?

Get new customers.

List your web site

in Yahoo! Search.

Y! Messenger

Send pics quick

Share photos while

you IM friends.

Wellness Spot

Embrace Change

Break the Yo-Yo

weight loss cycle.

.

__,_._,___

No comments: