Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Merging the rows Expand / Collapse
Author
Message
Posted Monday, November 19, 2012 2:13 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, January 29, 2014 8:21 AM
Points: 23, Visits: 58
The Output result set is coming as

Column
-------------------------
a-1 (row 1)
b-91e25b15-(row 2)
c-66364531(row 3)

expected output required(all rows needs to merged into single row)

a-1 b-91e25b15 c-66364531(row 1)






Post #1386227
Posted Monday, November 19, 2012 2:24 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, January 31, 2014 4:06 AM
Points: 83, Visits: 296
try this
declare @sql varchar(max)
select @sql=coalesce(@sql,'')+columnname
from
tablename

select @sql

Post #1386239
Posted Monday, November 19, 2012 3:13 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, January 29, 2014 8:21 AM
Points: 23, Visits: 58
Thank you
Post #1386261
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse