Re: How to concat the values in a column across rows.
From: Roji. P. Thomas (thoasroji_no_spam__at_gmail.com)
Date: 11/04/04
- Next message: Uri Dimant: "Re: output to text file"
- Previous message: maryam rezvani: "Some other tools**"
- In reply to: Colin Halliday: "Re: How to concat the values in a column across rows."
- Next in thread: vineetbatta: "Re: How to concat the values in a column across rows."
- Reply: vineetbatta: "Re: How to concat the values in a column across rows."
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 4 Nov 2004 12:10:27 +0530
The code is tested and working (atleast at my side)
-- Roji. P. Thomas Net Asset Management https://www.netassetmanagement.com "Colin Halliday" <colinh..at..kothes..com..au> wrote in message news:OaowTJjwEHA.3096@TK2MSFTNGP14.phx.gbl... >I tried your code but I receive an "Error 156: Incorrect syntax near the >keyword 'THEN' " error. > > Colin > > "Roji. P. Thomas" <thoasroji_no_spam_@gmail.com> wrote in message > news:uuLn62iwEHA.1452@TK2MSFTNGP11.phx.gbl... >> Try this >> >> >> USE Pubs >> GO >> --SELECT * FROM authors >> >> DECLARE @vchAuthors VARCHAR(400) >> SET @vchAuthors = '' >> SELECT @vchAuthors = @vchAuthors + >> CASE WHEN @vchAuthors = '' THEN '' ELSE ', ' END + au_lname >> FROM authors >> >> SELECT @vchAuthors >> >> -- >> Roji. P. Thomas >> Net Asset Management >> https://www.netassetmanagement.com >> >> >> "vineetbatta" <vineetbatta@discussions.microsoft.com> wrote in message >> news:B1F54C51-FBE9-4D06-B3D8-1F2ACF5D9CCA@microsoft.com... >>> Hi All, >>> >>> i am facing this problem... >>> >>> i have table "PLACEDATA" >>> which has 2 columns >>> >>> ZIPCODE CITYNAME >>> 56788 Seattle >>> 98007 Bellevue >>> 98009 Kirkland >>> >>> >>> Is there any way that using ONE Query to get the following concatnate >>> >>> result like >>> >>> AllPlaces >>> ---------- >>> Seattle,Bellevue,Kirkland >>> >>> I don't want to use while loop or cusors. >>> >>> -- >>> MCAD >>> Vineet Batta >> >> > >
- Next message: Uri Dimant: "Re: output to text file"
- Previous message: maryam rezvani: "Some other tools**"
- In reply to: Colin Halliday: "Re: How to concat the values in a column across rows."
- Next in thread: vineetbatta: "Re: How to concat the values in a column across rows."
- Reply: vineetbatta: "Re: How to concat the values in a column across rows."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|