A function like this would do it:

CREATE FUNCTION [dbo].[GetConcatString]
(     
) 
RETURNS VARCHAR(4000) 
 
AS
BEGIN 
    DECLARE @r VARCHAR(4000) 
    SELECT @r = ISNULL(@r+', ', '') +  a_lname 
        FROM yourTable c 
    RETURN @r 
END


and your select would be:
select [dbo].GetConcatString()
from yourTable

HTH,

Dharmendar Kumar
Email/ Fax Communications: http://www.realmagnet.com
Web Development: http://www.daksatech.com

> I have a authors table containing 
> publicationsa_id
> a_fname
> a_lname
> 
> I can concatenate the text with a_lname || '," || a_fname into 
> the_name.  I have a query that returns 3 rows, but I would like to 
> have each of the rows have the concatenated text from all the rows in 
> a column.  For example,
> 
> "lastname1,firstcharacter1;lastname2,firstcharacter2;lastname3,
> firstcharacter3;"
> 
> Is this doable?  I'll keep looking to figure it out.
> 
> thank you.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

Archive: http://www.houseoffusion.com/groups/SQL/message.cfm/messageid:2876
Subscription: http://www.houseoffusion.com/groups/SQL/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.6

Reply via email to