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 are key constraints?

958


Why do we partition data?

1008


What are the differences in Clustering in SQL Server 2005 and 2008 or 2008 R2?

1024


Tell me about the approaches which you used to counter the DI problems.

1323


can a database be shrunk to 0 bytes, if not, why? : Sql server administration

1174


How to query multiple tables jointly?

964


What are temporal tables in sql server 2016?

868


What is the maximum size of a dimension? : sql server analysis services, ssas

1023


How many joins in sql server?

929


How can I tell if sql server is 32 or 64 bit?

935


Explain contrast amongst grouped and non-bunched records?

1005


Can we use where clause with group by?

880


How to enter unicode character string literals in ms sql server?

1051


Explain how many normalization forms?

1005


Explain database normalization?

1199