Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
johnstern
Yak Posting Veteran
67 Posts |
Posted - 2007-08-23 : 17:06:37
|
| I have something like this UsersJOhnPeterLucasI would like to take all this rows and display them like so: John, Peter, Lucashow can i do this ? |
|
|
johnstern
Yak Posting Veteran
67 Posts |
Posted - 2007-08-23 : 17:12:39
|
| I found an article showing this wayDECLARE @EmployeeList varchar(100)SELECT @EmployeeList = COALESCE(@EmployeeList + ', ', '') + CAST(Emp_UniqueID AS varchar(5))FROM SalesCallsEmployeesWHERE SalCal_UniqueID = 1SELECT @EmployeeListand saw some post mention some issues, do you know if this a good way to do what i am trying to do |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-08-23 : 17:17:14
|
| Thats about the way to do it. Did you get any errors?Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
johnstern
Yak Posting Veteran
67 Posts |
Posted - 2007-08-23 : 17:47:08
|
| Is working fine for me, trying to break it right now but so far so good |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-08-24 : 05:28:33
|
quote: Originally posted by johnstern I found an article showing this wayDECLARE @EmployeeList varchar(100)SELECT @EmployeeList = COALESCE(@EmployeeList + ', ', '') + CAST(Emp_UniqueID AS varchar(5))FROM SalesCallsEmployeesWHERE SalCal_UniqueID = 1SELECT @EmployeeListand saw some post mention some issues, do you know if this a good way to do what i am trying to do
If the concatenated string exceeds more than varchar length, you should use more than one variable. If you want to show the data at front end application, you can easily concatenate thereMadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|
|