Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

there is a table having two columns no and name
and the data is
1 A
2 B
3 C

write a query that will result a horizontal output
A,B,C

Answer Posted / piyush sachan

DECLARE @List VARCHAR(8000)
SELECT @List = ISNULL(@List + ',', '') +names
FROM NewNew

SELECT @List

Orrrrrr

DECLARE @List VARCHAR(8000)
SELECT @List = COALESCE(@List + ',', '') +names
FROM NewNew

SELECT @List

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the sql case statement used for?

1105


How to restore performance issues and how to check?

2008


What does asynchronous call backs means?

1164


Explain use of expression builder.

1030


What the different topologies in which replication can be configured?

1094


How to create median function?

166


What are partitioned views and distributed partitioned views?

1025


What is the new security features added in sql server 2016? : sql server security

1121


What action plan is preferred if sql server is not responding?

1108


Explain insert into select statement?

963


How to rename an existing table with the "sp_rename" stored procedure in ms sql server?

1034


How to add an address record into adventureworkslt?

987


What are the types of dml?

984


What is the purpose of self join?

977


How do I find the sql server instance name?

972