Wrox Programmer Forums
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 22nd, 2007, 09:34 PM
Authorized User
 
Join Date: Jun 2005
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to aldwinenriquez
Default Comma Separated values

I have a the ff tables:

Users(UserID,Username)

Departments(DepartmentID,DepartmentName)

UserDepartments(UserID,DepartmentID)

I want to display the list of departments in a comma-separated fashion.
I tried using COALESCE,FOR XML PATH for these and Im having performance issues when the query returns lots of data.

Im using UDFs for coalesce. Could be the reason why Im hitting performance.

Is there any other way of doing it?

"Dont you ever give up!"
__________________
\"Dont you ever give up!\"
 
Old May 23rd, 2007, 11:38 AM
Authorized User
 
Join Date: Oct 2005
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try checking out the following link that returns a comma-delimited string without using a cursor and see if it will help you:

http://www.sql-server-helper.com/tip...ed-output.aspx

SQL Server Helper
How well do you know SQL? Find out with the free test assessment from SQL Server Helper!!!
http://www.sql-server-helper.com/free-test/default.aspx

Got a SQL Server Question? Ask us here: http://www.sql-server-helper.com/forums/default.asp
 
Old May 24th, 2007, 01:48 AM
Authorized User
 
Join Date: Jun 2005
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to aldwinenriquez
Default

Using Coalesce is faster than that.

I have 14 columns that are comma separated and calling UDFs for those columns I think is not an option.

Thank you anyway..

"Dont you ever give up!"
 
Old June 1st, 2007, 08:52 PM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

Quote:
quote:Originally posted by aldwinenriquez
 Using Coalesce is faster than that.
Got any test code that proves that?

--Jeff Moden





Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate a list box from comma separated values CoderNH Access VBA 3 October 20th, 2008 08:37 AM
retrieving comma separated values from column abhishekkashyap27 SQL Server 2005 6 April 21st, 2008 09:27 AM
comma separated list MunishBhatia SQL Server 2000 11 March 21st, 2007 03:56 PM
Comma Separated Column Value thru T-SQL subhendude SQL Server 2000 2 December 12th, 2006 01:42 PM
Select from Comma Separated Values sasidhar79 SQL Server 2000 2 March 28th, 2005 06:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.