I have table where content have html values and trying to concatenate them with
<ul> <li>
I have used below query
CREATE TABLE #T(Value varchar(1000))
INSERT INTO #T
values('<p><b>AA</b> something 1</p>'),('<p><b>BB</b> something 2</p>'),('<p><b>CC</b> something 3</p>')
select *
from #T
SELECT '<ul>' +STUFF((SELECT '<li>' + Value + '</li>'
FROM #T
FOR XML PATH('')), 1, 0, '') + '</ul>' AS Notes
Is there anyway to get the HTML as it is, so output will be as below
<ul>
<li><p><b>AA</b> something 1</p></li>
<li><p><b>BB</b> something 2</p></li>
<li><p><b>CC</b> something 3</p></li>
</ul>
Not like
<ul><li><p><b>AA</b> something 1</p></li><li><p><b>BB</b> something 2</p></li><li><p><b>CC</b> something 3</p></li></ul>