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

what is a schema in sql server 2005? Explain how to create a new schema in a database? : Sql server database administration

957


What does normalization do to data?

993


Can you explain how long are locks retained within the repeatable_read and serializable isolation levels, during a read operation with row-level locking?

937


What is primary key, unique key, and foreign key?

920


What the different components of Replication and what is their use?

1017


Can group functions be mixed with non-group selection fields in ms sql server?

892


How to find the version of sql server? : sql server database administration

1047


How to use linked server?

1089


What are distributed partitioned views?

1009


you want to be sure that queries in a database always execute at the maximum possible speed. To achieve this goal you have created various indexes on tables which other statement will keep the database in good condition? : Sql server administration

1004


How do you improve the performance of a SQL Azure Database?

135


What happens when the SQL Azure database reaches Max Size?

108


What are the lambda triggers?

858


What is the difference between Normalization and De-normalization?

1031


you accidentally delete the msdb database what effect does this have on your existing sql databases, and how do you recover? : Sql server administration

1195