使用以下SQL:
DECLARE @xml XML=
(
SELECT
N'' AS [content1/\*]
, N'' AS [content2/\*]
FOR XML PATH('Rows')
)
SELECT @xml
Run Code Online (Sandbox Code Playgroud)
我得到自我关闭的标签,如:
<Rows>
<content1 />
<content2 />
</Rows>
Run Code Online (Sandbox Code Playgroud)
是否有可能得到这个,在HTML中使用?
<Rows>
<content1></content1>
<content2></content2>
</Rows>
Run Code Online (Sandbox Code Playgroud)
此外,是否可能,即没有根节点?
<content1></content1>
<content2></content2>
Run Code Online (Sandbox Code Playgroud)