Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Column to row 1

Status
Not open for further replies.

xxing

Programmer
Feb 17, 2004
61
NZ
Hi I have a Table with this data

#Fruit
Apple
Pear
Orange

I would like a table that has the following

#Final
Apple, Pear, Orange

i.e changing a column to a single row.


Regards
Mark
 
Hi,

How about this?

Code:
DECLARE @mystring varchar(100)
SELECT @mystring = COALESCE(@mystring + ', ', '') +  [Field] FROM [Table]
select @mystring

Ry
 

Thank you RyanEk for your valuable post. A star for you!!

Regards
Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top