I have to shred the xml contents (transaction xml ) into some 7 tables. The approaches i’d in mind is
a) Single SP, use OPENXML and traverse through the xml contents and update the required tables.
b) Load xml in Xdoc and make a entity objects and update the required tables.
XML is big in size and has around 1000+ nodes.
Which is the best approach of the above two?
SQL Server has had XQuery since version 2005. That’s the preferred way to work with XML nowadays and has been for a long time.
OpenXML has many limitations and issues, one of the biggest is the possibility of memory leaks when you don’t dispose of the handle properly.
Just picking on one StackOverflow sample question and one Google result: