on 2017 Dec 06 10:32 AM
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
Request clarification before answering.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.