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
Tell me what is difference between view and materialized view?
What is a cache in ssrs?
Can you explain important index characteristics?
What is difference between index and primary key?
What is sql collation?
How to write a query with a full outer join in ms sql server?
Define inner join in sql server joins?
Explain logical operators in sql server?
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?
How to provide default values to stored procedure parameters?
What is a join in sql? What are the types of joins?
Can we take the full database backup in log shipping?
Explain transaction server isolation?
What is trigger and different types of Triggers?
what is normalization? Explain different levels of normalization? : Sql server database administration