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 / utsav

declare @tst varchar(max)
set @tst=''
select @tst=@tst+col+',' from table
select @tst

there is a twist, if col contains any null value then this
query will return null. use isnull(col,'') in that case

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What stored by the msdb? : sql server database administration

1052


How to drop existing indexes in ms sql server?

1130


Define cross join in sql server joins?

1078


What is the difference between varchar and nvarchar?

986


What are the restrictions while creating batches in sql server?

1113


you have developed an application which uses many stored procedures and triggers to update various tables users ocassionally get locking problems which tool is best suited to help you diagnose the problem? : Sql server administration

1009


Can we insert data into a view?

1194


what are the different stages of Report Processing?

141


What is the difference between functions and scalar functions?

1278


Explain the characteristics of a transaction server for example atomicity, consistency, isolation, durability?

1181


Explain about sql server login?

1134


What are the different normalization forms?

1163


Is truncate a dml command?

999


What is a mixed extent?

1078


What is resource governor in sql server?

1049