简体   繁体   中英

Convert table into XML

I have table as below

Project  Folder   Type     Type_Name    Name          Value
Project1  ABC    Workflow   wf_name   Batch_Table   Table_Name
Project1  ABC    Workflow   wf_name   Batch_Conn    JDBC
Project1  ABC    Mapping    mapp_name BALANCE_Table Bal_Table_Name
Project1  ABC    Mapping    mapp_name Schema        Schema_Name

And I need to convert that into the below XML. Is there any way we can achieve this in SQL Server?

I have attached the desired output.

https://i.stack.imgur.com/Yydr4.png

You can add FOR XML PATH to your query.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM