I have a query result of two columns that looks like this
name text
---------------
John hello
Carl hi
Doe my text
Alice another text
I would like to find a way how to format this result as a text. What I need is this output:
John:
hello
_____
Carl:
hi
_____
Doe:
my text
_____
Alice:
another text
_____
So in other words I need to take the first column's value as a text, append some text to it, append second column's value as a text and append some more text. And do that for every row.
Is there an easy way of how to do this using only SQL Server's syntax?
EDIT: I am only using Microsoft SQL Server Management Studio and I need the whole result as a plain text. I was thinking of writing a function that would return it?
EDIT2: I am using SQL Server 2016
order byclause