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

How to retrieve field values using mssql_result()?

1415


What is 'Join' and explain its various types.

1211


What do you mean by sql server agent?

1040


Describe different Processing Modes offered by SSRS?

256


What is shrink log file?

952


How to get a list all databases on the sql server?

1159


Explain the advantages of merge replication?

1010


What does REVERT do in SQL Server 2005?

1012


What is an indexed view?

1007


Can multiple columns be used in sql group by clause in ms sql server?

1115


What are the steps to process a single select statement?

988


What is xdr?

1041


Is the primary key column of a table an index in ms sql server?

1003


Explain stored procedure?

1108


What are the methods used to protect against sql injection attack?

1118