Concatenate multiple XML rows to one in SQL table

Oct 29 2020 3:04 PM

I have the below table Person

Name

Place

XML Info

Tom

USA

<PersonInfo>

<Name>Tom</Name>

<Age>20</Age>

<Sex>M</Sex>

</PersonInfo>

Dick

UK

<PersonInfo>

<Name>Dick</Name>

<Age>21</Age>

<Sex>M</Sex>

</PersonInfo>

Hary

AUS

<PersonInfo>

<Name>Hary</Name>

<Age>22</Age>

<Sex>M</Sex>

</PersonInfo>

I want one big XML as output(in one column) without connectors like ‘+’ or commas

Select xml Info from Person

<PersonInfo><Name>Tom</Name><Age>20</Age><Sex>M</Sex></PersonInfo><PersonInfo><Name>Dick</Name><Age>21</Age><Sex>M</Sex></PersonInfo><PersonInfo><Name>Hary</Name><Age>22</Age><Sex>M</Sex></PersonInfo>


Answers (1)