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 |
scelamko
Constraint Violating Yak Guru
309 Posts |
Posted - 2007-11-15 : 15:43:08
|
I have table - employeedescription which stores description of the employee. An employee can have multiple descriptions, below functions returns all the employeedescription for each employee, Is ther any way to concatenate all the descriptions for an employee into a single rowempid empdescription_______________________________1 Joined in 19711 Raise in 19761 change department in 1980output should be empid empdescription_______________________________1 Joined in 1971 Raise in 1976 change department in 1980ALTER function [dbo].[F_GETDESC](@sk bigint) returns varchar(2000)asbegin declare @desc varchar(2000) SELECT @desc= ltrim(rtrim(description))+ '...' FROM employeedescription WHERE employeedescription.key=@sk return @descendAny suggestions and input should helpThanks |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-11-15 : 15:49:18
|
SELECT @desc = isnull(@desc, '') + ltrim(rtrim(description)) + ','FROM employeedescriptionWHERE employeedescription.key = @skORDER BY description_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
|
|