DECLARE @Cities VARCHAR(8000) SELECT @Cities = ISNULL(@Cities + ',', '') + CityColumn FROM dbo.Table1 SELECT @Cities AS OutputCol1 GO
DECLARE @myCity VARCHAR(MAX) SELECT @myCity = COALESCE(@myCity +',' ,'') + CityColumn FROM Table1 SELECT @myCity --@myCity will have the values as --Mumbai,Banglore,Chennai,Colcutta,Delhi,Ahmedabad
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)