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 / piyush sachan
DECLARE @List VARCHAR(8000)
SELECT @List = ISNULL(@List + ',', '') +names
FROM NewNew
SELECT @List
Orrrrrr
DECLARE @List VARCHAR(8000)
SELECT @List = COALESCE(@List + ',', '') +names
FROM NewNew
SELECT @List
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the sql case statement used for?
How to restore performance issues and how to check?
What does asynchronous call backs means?
Explain use of expression builder.
What the different topologies in which replication can be configured?
How to create median function?
What are partitioned views and distributed partitioned views?
What is the new security features added in sql server 2016? : sql server security
What action plan is preferred if sql server is not responding?
Explain insert into select statement?
How to rename an existing table with the "sp_rename" stored procedure in ms sql server?
How to add an address record into adventureworkslt?
What are the types of dml?
What is the purpose of self join?
How do I find the sql server instance name?