用下面的SQL:防止自閉合標籤通過SQL Sever的
DECLARE @xml XML=
(
SELECT
N'' AS [content1/\*]
, N'' AS [content2/\*]
FOR XML PATH('Rows')
)
SELECT @xml
我得到自我結束標記,如:
<Rows>
<content1 />
<content2 />
</Rows>
是否有可能獲得此相反,以在HTML中使用?
<Rows>
<content1></content1>
<content2></content2>
</Rows>
另外,是否有以下可能,即沒有根節點?
<content1></content1>
<content2></content2>
試用**無根節點**'SELECT '' AS [內容1], '' AS [內容2] FOR XML PATH('')' –