I am passing XML type variable from one procedure to another procedure.
Set XML variable like this
Declare @XMLDOC XML
set @XMLDOC = (select 60 as RecordDetailID,
'' as ItemText,
'' as ItemNote,
0 as DisplayOrder
FOR XML RAW)
In some case I need send one more "Status" column to another procedure like below
set @XMLDOC = (select 60 as RecordDetailID,
'' as ItemText,
'' as ItemNote,
0 as DisplayOrder,
1 as Status
FOR XML RAW)
How I would know how many 开发者_运维知识库columns have been sent to my the XML Type variable?
You can use the nodes() method to count XML attributes:
select count(1) from @XMLDOC.nodes('row/@*') as T(c);
精彩评论