Shredding XML from DB using SSIS

不打扰是莪最后的温柔 提交于 2019-12-06 18:45:26

So after a lot of searching and thinking about the problem, I redesigned the stored procedures that did the shredding. Instead of shredding a variable being passed into the stored procedure, I just shredded from the XML column itself. This allowed me to shred many XML values at once instead of looping and passing them to a stored procedure one at a time. This gave me the performance boost I was looking for. So instead of something like this...

SET @xmlData = CAST(@xmlMessageData AS XML)

SELECT
   , row.value('xmlNode1[1]', 'BIT' )                   AS Column1  
   , row.value('xmlNode2[1]', 'NVARCHAR(255)')          AS Column2
   , row.value('xmlNode3[1]', 'BIT' )                   AS Column3
   , row.value('xmlNode4[1]/Name[1]', 'NVARCHAR(255)' ) AS Column4
FROM @xmlData.nodes('xmlRootNode') AS T1(row)

I now do this...

SELECT
   , row.value('xmlNode1[1]', 'BIT' )                   AS Column1  
   , row.value('xmlNode2[1]', 'NVARCHAR(255)')          AS Column2
   , row.value('xmlNode3[1]', 'BIT' )                   AS Column3
   , row.value('xmlNode4[1]/Name[1]', 'NVARCHAR(255)' ) AS Column4
FROM [ESBMessagesData] D
CROSS APPLY
    [DataItem].nodes('xmlRootNode') AS T1(row)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!