I have a table like
create table temp_table (col1 int)
I have some data in this table like
insert into temp_table
values(1), (2), (3), (4)
Now I want the data to be output as follows:
1,2,3,4
I have used the query:
select cast(col1 as nvarchar)+','
from temp_table
for xml path('')
The problem is that the output comes in XML format and i need it in simple text/string format. I tried searching for transpose but FOR XML()
was mentioned everywhere and it didn't helped me.
Any suggestions?