What is the best way to shred a large complex XML document into a SQL Table?

Kieran Wood 111 Reputation points
2023-11-08T14:22:10.4666667+00:00

Hi,

What is the best way to shred a large complex XML document into a SQL Table?

Kind Regards,

Kieran.

Developer technologies | Transact-SQL
SQL Server | Other
{count} votes

2 answers

Sort by: Most helpful
  1. Gérald Döserich 765 Reputation points
    2023-11-09T20:40:53.4533333+00:00

    MSSQL has native xml support if you need to query the XML directly.

    Other than that use varchar(max) or varbinary(max) as documented here: https://learn.microsoft.com/en-us/sql/relational-databases/xml/xml-data-type-and-columns-sql-server?view=sql-server-ver16#xml-storage-options

    0 comments No comments

  2. LiHongMSFT-4306 31,571 Reputation points
    2023-11-10T03:10:13.8333333+00:00

    Hi @Kieran Wood

    Not that familiar with XML shred.

    But here are two similar threads that you might refer to:

    The Best Way to shred XML data into SQL Server database columns

    How can I shred this Extended Events XML as fast as possible?

    Best regards,

    Cosmog Hong


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.