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
What is a data source or ds? : sql server analysis services, ssas
What is dirty page?
How to delete multiple rows with one delete statement in ms sql server?
Can we return Data from 4(more than 1) tables in stored procedure?
What is the meaning of sql server?
How to filter records of table in SQL SERVER?
How do we Backup SQL Azure Data?
Explain what is the function of sql server agent windows service?
mention different types of relationships in the dbms?
how to create “alternate row colour”?
How can I create a new template for import ? : sql server management studio
According to you what goes into making the best database administrator? : sql server database administration
How to modify the underlying query of an existing view?
What do you understand by recursive stored procedures?
Explain sql server service broker?