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


SQLXMLBULKLOAD mapping file


SQLXMLBULKLOAD mapping file

Author
Message
bhagya.puccha
bhagya.puccha
SSC Rookie
SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)SSC Rookie (26 reputation)

Group: General Forum Members
Points: 26 Visits: 17
Hi,

I tried SQLXMLBulkLoad option by creating the mapping file and VB script, its not giving any error when I run the VB script and not loading the data into temp table.Here is my mapping file and VB script. How to map the attribute value job id into sql field along with cycle_no and pdm elements
and How to map the hard coded table name to sql:relation valueÉ


Customers.xml :

<?xml version="1.0" ?>
<batch>
<job id="100360003">
<cycle_no type="string">36</cycle_no>
<PDM type="string">C</PDM>
</job>
<job id="100360004">
<cycle_no type="string">36</cycle_no>
<PDM type="string">C</PDM>
</job>
</batch>

Customermapping.xml :

<?xml version="1.0" ?>
<Schema xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:xml:datatypes"
xmlns:sql="urn:schemas-microsoft-com:xml-sql" >


<AttributeType name="Id" />
<ElementType name="Cycle_no" dt:type="string" />
<ElementType name="PDM" dt:type="string" />

<ElementType name="batch" sql:is-constant="1">
</ElementType>

<ElementType name="job" sql:relation="temp_xml">
<attribute type="Id" sql:field="Id" />
<element type="Cycle_no" sql:field="Cycle_no" />
<element type="PDM" sql:field="PDM" />
</ElementType>

</Schema>

Insertcustomers.vbs

Set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad")
objBL.ConnectionString = "provider=XXXXXXXX;data source=XXXXXXXX;database=XXXXXX;uid=XXXXXX;pwd=XXXXX"
objBL.ErrorLogFile = "c:\error.log"
objBL.Execute "c:\customermapping.xml", "c:\customers.xml"
Set objBL = Nothing
Lowell
Lowell
SSC Guru
SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)

Group: General Forum Members
Points: 75183 Visits: 40985
duplicate post.
There's no need to post the same question in multiple forums.
The Recent Posts>>Posts Added Today function which most people use shows us your post immediately.
crossposting will wastes people's time and fragments replies.

No replies to this thread please. Direct replies to
http://www.sqlservercentral.com/Forums/Topic1467296-21-1.aspx

Lowell
--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
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