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 command is used to create a database in the sql server and how?

1112


Can sub report data source be different from that of the parent report?

135


what are questions asked in TCS for database tester (sqlserver)for 2-3 exp?

5872


What are two difference between sql azure and azure tables?

159


What xml support does the sql server extend?

955


What security features are available for stored procedure?

986


Do you know what is a with(nolock)?

994


Explain “not null constraint” in sql server?

956


What is difference between rollback immediate and with no_wait during alter database?

1016


How to execute stored procedure in select statement sql server?

985


What is difference between temp table and cte?

960


What are the differences between having and where clause.

920


What is create statement?

888


What is proper subset of candidate key?

945


Do you know exporting and importing utility?

972