Skip to Content
0

mii Sql bulk insert

Dec 06, 2017 at 10:32 AM

54

avatar image

Hi All,

I am trying to insert multiple Xml rows in sql Db. so i Selected some rows from 1 table and am trying to insert whole of it in another table in just one hit. I am able to pull out a bulk insert query which adds multiple hard code xml rows in a go but the challenge i am facing is how to get data from my transaction to query.

I am currently trying to access a xml file (which can later be changed as per documents output ) but code is showing some syntax error near to parameter which i am not able to resolve. can someone help me!

This the code snipet i have developed so far:-

INSERT INTO (Engine, equipment_id)
SELECT X.query('equipment_id').value('(./equipment_id)[1]', 'DOUBLE'),
X.query('Engine').value('(./Engine)[1]', 'VARCHAR(100)')
FROM (
SELECT CAST(x AS XML)
FROM OPENROWSET(
BULK , !!Shows invalid syntex at "@P1"
SINGLE_BLOB) AS T(x)
) AS T(x)
CROSS APPLY x.nodes('Rowsets/Rowset/Row') AS X;

Thank You

Regards,

Ayush Mittal

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers