Create XML with variable element names from a data table with values and names

前端 未结 2 933
北恋
北恋 2020-12-21 20:08

I wasn\'t able to find a relevant post, so I decided to ask.

I have the following table in my SQL Server database:

ID       attname    value 
-------         


        
2条回答
  •  爱一瞬间的悲伤
    2020-12-21 20:40

    As far as I know, there is no control over the way the output is generated in the FOR XML output, aside from manipulating the data types and field names in the query.

    You would need to generate it as it normally does, then reprocess it possibly with XSLT to make it into what you want.

    This could actually be done on the server if it has support for the CLR.

提交回复
热议问题