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 / senthil kumar murugan

;WITH ABC (no, name) AS
(
SELECT 1, CAST('' AS VARCHAR(8000))
UNION ALL
SELECT B.no + 1, B.name + A.name + ', '
FROM (
SELECT Row_Number() OVER (ORDER BY no) AS no, name FROM
emp1) A
INNER JOIN ABC B ON A.no = B.no
)
SELECT TOP 1 name FROM ABC ORDER BY no DESC

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to generate create procedure script on an existing stored procedure?

1017


What are cursors stored procedures and triggers?

1024


Explain the third normal form(3nf)?

952


What were the latest updates to SQL Azure service?

111


Write a code to select distinct records without using the DISTINCT keyword.

1123


Do you know what are acid properties of transaction?

963


Do you know what is lock escalation?

1017


What is the architecture of ms sql reporting service?

992


Does any body please help me what question's have asked for SSRS in the interview?

2154


Do you know what is difference between stored procedure and user defined function?

1105


What is the order in which the sql query is executed?

945


What is SQL Azure Fabric?

110


What is Command line parameters in PLSQL.?

1137


Explain about extended stored procedure?

950


Can you please explain the difference between primary keys and foreign keys?

1124