Execution Plan Warnings cardinality xml data type
Add TYPE
to return XML
from the inner query rather than a string
DECLARE @AuditParameters XML = (
SELECT
1 AS AccountID,
2 AS CategoryID,
3 AS CategoryAttributeID,
'4' AS SyncBatchGUID
FOR XML PATH(N'Parameters'), ELEMENTS XSINIL, TYPE
)
Use TYPE Directive in FOR XML Queries
SQL Server support for the xml (Transact-SQL) enables you to optionally request that the result of a FOR XML query be returned as xml data type by specifying the TYPE directive.
-- 1st
DECLARE @AuditParameters XML = (
SELECT
1 AS AccountID,
2 AS CategoryID,
3 AS CategoryAttributeID,
'4' AS SyncBatchGUID
FOR XML PATH(N'Parameters'), ELEMENTS XSINIL,Type
)