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

Tell me what is difference between view and materialized view?

881


What is a cache in ssrs?

127


Can you explain important index characteristics?

935


What is difference between index and primary key?

1038


What is sql collation?

1129


How to write a query with a full outer join in ms sql server?

998


Define inner join in sql server joins?

986


Explain logical operators in sql server?

1031


How many files can a database contain in sql server?how many types of data files exists in sql server? How many of those files can exist for a single database?

1084


How to provide default values to stored procedure parameters?

1002


What is a join in sql? What are the types of joins?

1005


Can we take the full database backup in log shipping?

898


Explain transaction server isolation?

979


What is trigger and different types of Triggers?

1067


what is normalization? Explain different levels of normalization? : Sql server database administration

1209