本文介绍了如何让 SQL 生成开始和结束 XML 标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 SQL 需要将开始和结束 XML 标记呈现为 NOT .

I know this is not the standard but I have a business reason to do it this way. I have tried several variations of the FOR XML PATH ('') statement but can't seem to get it to render as <PropName></PropName>.

select [PropName] as '*' for xml path(''), type) as [PropName]

renders .我现在必须洗手;-)

And finally: If you really need such a conversion you could create the XML, cast it to VARCHAR and use Replace to change all <PropName /> to <PropName></PropName>. I have to wash my hands now ;-)

这篇关于如何让 SQL 生成开始和结束 XML 标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-21 23:56