Share via

Load xml data to sql table

Jefferson-2765 586 Reputation points
2023-11-27T07:04:32.0833333+00:00

How to do that in tsql or ssis?

Please show me step by step.

SQL Server Integration Services
Developer technologies | Transact-SQL
Developer technologies | Transact-SQL

A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.

0 comments No comments

Answer accepted by question author

ZoeHui-MSFT 41,551 Reputation points
2023-11-27T07:13:45.14+00:00

Hi @Jefferson,

You may follow Import XML documents into SQL Server tables using SSIS packages for details.

To use T-SQL, you may check below code.

INSERT INTO T
SELECT 10, xCol
FROM    (SELECT *
    FROM OPENROWSET (BULK 'C:\MyFile\xmlfile.xml', SINGLE_BLOB)
AS xCol) AS R(xCol);

Check https://learn.microsoft.com/en-us/sql/relational-databases/xml/load-xml-data?view=sql-server-ver16

Regards,

Zoe Hui


If the answer is helpful, please click "Accept Answer" and upvote it.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

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