SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


RE: - XML import Solution-Encoding="UTF-8"


RE: - XML import Solution-Encoding="UTF-8"

Author
Message
raym
raym
SSC Veteran
SSC Veteran (211 reputation)SSC Veteran (211 reputation)SSC Veteran (211 reputation)SSC Veteran (211 reputation)SSC Veteran (211 reputation)SSC Veteran (211 reputation)SSC Veteran (211 reputation)SSC Veteran (211 reputation)

Group: General Forum Members
Points: 211 Visits: 307
--==== Command Syntax:
DECLARE @Str VARCHAR(1000)
SELECT @Str ='xml sel -T -t -m "/INDIVIDUALS/INDIVIDUAL" -v "position()" -o "," -v "FIRST_NAME[position()=1]" -o "," -v "@type" -o "," -c "SECOND_NAME" -n consolidatedlist.xml'

EXEC (@Str)

--==== Step 1: Prepare a Parameter Table
--==== usp_ImportXML stored procedure looks for a temporary table called #tblXMLParams.
--==== This temp table specifies the record-defining node, the delimiter to be used to
IF NOT object_id('tempdb..#tblXMLParams') IS NULL
BEGIN
DROP Table #tblXMLParams
END

CREATE TABLE #tblXMLParams (XPathOrder int, NodeType VARCHAR(20), XPathExpression VARCHAR(500))
INSERT INTO #tblXMLParams VALUES (0,'Record_Node','/INDIVIDUALS/INDIVIDUAL') ????????????

This is what I have in the file xml file has
so what will my XPathExpression be ?


INSERT INTO #tblXMLParams VALUES (0,'Delimiter','|')
INSERT INTO #tblXMLParams VALUES (1,'XPATH','position()')
INSERT INTO #tblXMLParams VALUES (2,'node','FIRST_NAME[position()=1]')
INSERT INTO #tblXMLParams VALUES (3,'Attribute','@type')
INSERT INTO #tblXMLParams VALUES (4,'node','SECOND_NAME') ETC.....

I want to extract the nodes as they are in the xml file then bulk insert into a staging table

How do I do it with encoding="UTF-8"


I HAVE ATTACHED THE XML FILE



Attachments
consolidatedlist.zip (43 views, 60.00 KB)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search