Friday, March 23, 2012
Error when importing XML to SQL-server using activX
http://www.perfectxml.com/articles/X...rtXMLSQL.asp#3
But i get an error when the import is finish:
Error Source: Microsoft Data Transformation Service (DTS) Package
Error Description: ActiveX Scripting encounted a Run Time Error during
the execution of the script.
The data is imported to the table as it should
What could be the problem?//Peter
"Peter" <dj-pnr@.get2net.dk> wrote in message
news:4073f900@.news.wineasy.se...
[snip]
> The data is imported to the table as it should
> What could be the problem?//Peter
If the data gets imported, then it is probably a problem with syntax at the
end of your script. Check to make sure it is correct.
Bryant
|||I have the following code:
'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************
Dim objXBulkLoad
Set objXBulkLoad = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad.3.0")
objXBulkLoad.ConnectionString =
"PROVIDER=SQLOLEDB.1;SERVER=000.000.000.000;UID=ad m;PWD=password;DATABASE=No
rthWind;"
objXBulkLoad.KeepIdentity = False
'Optional Settings
objXBulkLoad.ErrorLogFile = "c:\NWError.LOG"
objXBulkLoad.TempFilePath = "c:\temp"
'Executing the bulk-load
objXBulkLoad.Execute "c:\books.xsd", "c:\books.xml"
Main = DTSTaskExecResult_Success
Can you see any errors?
"Bryant Likes" <bryant@.suespammers.org> skrev i en meddelelse
news:uekmKakHEHA.3476@.TK2MSFTNGP11.phx.gbl...
> "Peter" <dj-pnr@.get2net.dk> wrote in message
> news:4073f900@.news.wineasy.se...
> [snip]
> If the data gets imported, then it is probably a problem with syntax at
the
> end of your script. Check to make sure it is correct.
> --
> Bryant
>
|||"Peter" <dj-pnr@.get2net.dk> wrote in message
news:407bedf5$1@.news.wineasy.se...
[snip]
> Main = DTSTaskExecResult_Success
> Can you see any errors?
It doesn't look like you have a Function called main, so that last line
would cause the error. You should wrap everything in a function like:
Function Main()
''' Insert all your code here
Main = DTSTaskExecResult_Success
End Function
Bryant
|||Xref: TK2MSFTNGP08.phx.gbl microsoft.public.sqlserver.xml:23306
Tanks! That solved my problem
"Bryant Likes" <bryant@.suespammers.org> skrev i en meddelelse
news:%237pbt4dIEHA.3964@.TK2MSFTNGP10.phx.gbl...
> "Peter" <dj-pnr@.get2net.dk> wrote in message
> news:407bedf5$1@.news.wineasy.se...
> [snip]
> It doesn't look like you have a Function called main, so that last line
> would cause the error. You should wrap everything in a function like:
> Function Main()
> ''' Insert all your code here
> Main = DTSTaskExecResult_Success
> End Function
> --
> Bryant
>
Wednesday, March 21, 2012
error when executing sql xml bulk load
my problem. I get a bulk load error stating I need a sql:relationship for
any of my nested complex types but the elements in my nested complex type is
not going to another table but to the same table as my first complex type.
How do I create nested complex types that bulk load the elements to the same
table?
In the example below how do I represent the "Phone" as a complex type in the
xsd and have the bulk upload load the elements to the same table as my root
complex type?
Ex.
<Root>
<ContactInfo>
<FirstName></FirstName>
<LastName></LastName>
<Phone>
<Home></Home>
<Cell></Cell>
</Phone>
</ContactInfo>
</Root>
So how do i layout the xsd for the "Phone" and either not have to provide
the relationship if the data goes to the same sql table or how do I provide
the sql:relationship so I don't get the error?
Hello Semloh,
I have notice that you have send the same issue on Feb 27th which I have
replied. Please check my answer there, and if you need any further
assistance on this particular issue please reply to me in that thread so I
can follow up with you. In the future, please don't cross-post the same
question in multiple newsgroups. This will help our engineers work on your
question more efficiently. Your understanding and cooperation is
appreciated.
For your convenience, I have included my reply as follows:
Based on my research, you should follow the article to create 2 table to
get the XML file uploaded to the database.
XML Bulk Load Examples (SQLXML 4.0)
http://msdn2.microsoft.com/en-us/ms171806.aspx
In this article you could see that the XSD schema include a
sql:relationship attribute.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xsd:annotation>
<xsd:appinfo>
<sql:relationship name="CustCustOrder"
parent="Cust"
parent-key="CustomerID"
child="CustOrder"
child-key="CustomerID" />
</xsd:appinfo>
</xsd:annotation>
<xsd:element name="ROOT" sql:is-constant="1" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Customers" sql:relation="Cust" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CustomerID" type="xsd:integer" />
<xsd:element name="CompanyName" type="xsd:string" />
<xsd:element name="City" type="xsd:string" />
<xsd:element name="Order"
sql:relation="CustOrder"
sql:relationship="CustCustOrder" >
<xsd:complexType>
<xsd:attribute name="OrderID" type="xsd:integer" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
If you want to upload all the element into one table, you could use a XSLT
to transform the original XML file to up the level of your Phone element.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
|||Hi,
If the Phone element is just a wrapper for Home and Cell (whch will be
mapped to fileds in the database) that you can use sql:is-constant="true" on
the Phone element and you don't need relationship.
I hope this helps.
Thanks,
Monica Frintu
"semloh" wrote:
> I am using the SQL bulk load 4 but am new to xsd and sql schemas. Here is
> my problem. I get a bulk load error stating I need a sql:relationship for
> any of my nested complex types but the elements in my nested complex type is
> not going to another table but to the same table as my first complex type.
> How do I create nested complex types that bulk load the elements to the same
> table?
> In the example below how do I represent the "Phone" as a complex type in the
> xsd and have the bulk upload load the elements to the same table as my root
> complex type?
> Ex.
> <Root>
> <ContactInfo>
> <FirstName></FirstName>
> <LastName></LastName>
> <Phone>
> <Home></Home>
> <Cell></Cell>
> </Phone>
> </ContactInfo>
> </Root>
>
> So how do i layout the xsd for the "Phone" and either not have to provide
> the relationship if the data goes to the same sql table or how do I provide
> the sql:relationship so I don't get the error?
>
error when executing sql xml bulk load
my problem. I get a bulk load error stating I need a sql:relationship for
any of my nested complex types but the elements in my nested complex type is
not going to another table but to the same table as my first complex type.
How do I create nested complex types that bulk load the elements to the same
table?
In the example below how do I represent the "Phone" as a complex type in the
xsd and have the bulk upload load the elements to the same table as my root
complex type?
Ex.
<Root>
<ContactInfo>
<FirstName></FirstName>
<LastName></LastName>
<Phone>
<Home></Home>
<Cell></Cell>
</Phone>
</ContactInfo>
</Root>
So how do i layout the xsd for the "Phone" and either not have to provide
the relationship if the data goes to the same sql table or how do I provide
the sql:relationship so I don't get the error?Hello Semloh,
I have notice that you have send the same issue on Feb 27th which I have
replied. Please check my answer there, and if you need any further
assistance on this particular issue please reply to me in that thread so I
can follow up with you. In the future, please don't cross-post the same
question in multiple newsgroups. This will help our engineers work on your
question more efficiently. Your understanding and cooperation is
appreciated.
For your convenience, I have included my reply as follows:
---
Based on my research, you should follow the article to create 2 table to
get the XML file uploaded to the database.
XML Bulk Load Examples (SQLXML 4.0)
http://msdn2.microsoft.com/en-us/ms171806.aspx
In this article you could see that the XSD schema include a
sql:relationship attribute.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xsd:annotation>
<xsd:appinfo>
<sql:relationship name="CustCustOrder"
parent="Cust"
parent-key="CustomerID"
child="CustOrder"
child-key="CustomerID" />
</xsd:appinfo>
</xsd:annotation>
<xsd:element name="ROOT" sql:is-constant="1" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Customers" sql:relation="Cust" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CustomerID" type="xsd:integer" />
<xsd:element name="CompanyName" type="xsd:string" />
<xsd:element name="City" type="xsd:string" />
<xsd:element name="Order"
sql:relation="CustOrder"
sql:relationship="CustCustOrder" >
<xsd:complexType>
<xsd:attribute name="OrderID" type="xsd:integer" />
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
If you want to upload all the element into one table, you could use a XSLT
to transform the original XML file to up the level of your Phone element.
---
Sincerely,
Wei Lu
Microsoft Online Community Support
========================================
==========
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscript...ault.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscript...t/default.aspx.
========================================
==========
(This posting is provided "AS IS", with no warranties, and confers no
rights.)|||Hi,
If the Phone element is just a wrapper for Home and Cell (whch will be
mapped to fileds in the database) that you can use sql:is-constant="true" on
the Phone element and you don't need relationship.
I hope this helps.
Thanks,
--
Monica Frintu
"semloh" wrote:
> I am using the SQL bulk load 4 but am new to xsd and sql schemas. Here is
> my problem. I get a bulk load error stating I need a sql:relationship for
> any of my nested complex types but the elements in my nested complex type
is
> not going to another table but to the same table as my first complex type.
> How do I create nested complex types that bulk load the elements to the sa
me
> table?
> In the example below how do I represent the "Phone" as a complex type in t
he
> xsd and have the bulk upload load the elements to the same table as my roo
t
> complex type?
> Ex.
> <Root>
> <ContactInfo>
> <FirstName></FirstName>
> <LastName></LastName>
> <Phone>
> <Home></Home>
> <Cell></Cell>
> </Phone>
> </ContactInfo>
> </Root>
>
> So how do i layout the xsd for the "Phone" and either not have to provide
> the relationship if the data goes to the same sql table or how do I provid
e
> the sql:relationship so I don't get the error?
>
Error when deploying on Server 2003
I built a utility that grabs large XML string from a database and then uses XML bulk load to shread the data in to 4 seperate tables. Everything works great on my box, but when I tried to move it to the dev server I started getting errors.
The first error I got was: Exception: Retrieving the COM class factory for component with CLSID {19AA7334-069C-437F-BFE4-CC9894DB8504} failed due to the following error: 80040154.
I evetually figured out that the XML bulkload dll 'xblkld4.dll' was not registered. I had a hard time getting the DLL registered as it was dependant on a lot of other dll's. Finally I copied all of the dll's from C:\Program Files\Common Files\System\Ole DB that had XML in them and I was able to register.
Now I am getting a new error that I can't find any information on. When the XML bulk load executes, I get the exception: Error creating SAX reader.
Is there a sax reader dll that I need to copy to the dev server and register? Does anybody have any ideas?
~Jason
I think this article may help you deploy your solution and fix your problems.
http://msdn2.microsoft.com/en-us/library/ms171744.aspx
Error when deploying on Server 2003
I built a utility that grabs large XML string from a database and then uses XML bulk load to shread the data in to 4 seperate tables. Everything works great on my box, but when I tried to move it to the dev server I started getting errors.
The first error I got was: Exception: Retrieving the COM class factory for component with CLSID {19AA7334-069C-437F-BFE4-CC9894DB8504} failed due to the following error: 80040154.
I evetually figured out that the XML bulkload dll 'xblkld4.dll' was not registered. I had a hard time getting the DLL registered as it was dependant on a lot of other dll's. Finally I copied all of the dll's from C:\Program Files\Common Files\System\Ole DB that had XML in them and I was able to register.
Now I am getting a new error that I can't find any information on. When the XML bulk load executes, I get the exception: Error creating SAX reader.
Is there a sax reader dll that I need to copy to the dev server and register? Does anybody have any ideas?
~Jason
I think this article may help you deploy your solution and fix your problems.
http://msdn2.microsoft.com/en-us/library/ms171744.aspx