473,385 Members | 1,384 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help using sp_xml_preparedocument

Hi all,

We are using a VB component to create and save an XML document on our
local LAN.

We want to load this straight into a DB Table using a query based on
OPENXML. Trouble is, the sp_xml_preparedocument command always throws an
error.

Here is some code:
CODE >>>>

DECLARE @idoc int
DECLARE @doc varchar(1000)

EXEC sp_xml_preparedocument @idoc OUTPUT, @doc
<<<< END OF CODE <<<<

where @doc is the filename of our file on the LAN to be opened, and
@idoc is the handle to be created.

the error is:
XML parsing error: Invalid at the top level of the document.

Here is some of the XML Document saved on the LAN that should be opened
by sp_xml_preparedocument and prepared.

<?xml version="1.0" encoding="UTF-8" ?>
<xdata created_by="OSA" created_at="Thu Nov 13 11:33:33 EST 2003">
<rows row_count="1000">
<row>
<COL1>714761905</COL1>
<COL2>714761905</COL2>
<COL3>714761905</COL3>
</row>
</xdata>

Any advice or tips whould be very helpful...

thanks

Phil

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #1
1 10307
The xml doc you posted is not well-formed; it is mussing the </rows> end
tag. In any case, the @doc parameter specifies the actual xml text, not
the path a file containing xml.

--
Hope this helps.

Dan Guzman
SQL Server MVP

-----------------------
SQL FAQ links (courtesy Neil Pike):

http://www.ntfaq.com/Articles/Index....partmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
-----------------------

"no spam" <an*******@devdex.com> wrote in message
news:3f*********************@news.frii.net...
Hi all,

We are using a VB component to create and save an XML document on our
local LAN.

We want to load this straight into a DB Table using a query based on
OPENXML. Trouble is, the sp_xml_preparedocument command always throws an error.

Here is some code:
> CODE >>>>
DECLARE @idoc int
DECLARE @doc varchar(1000)

EXEC sp_xml_preparedocument @idoc OUTPUT, @doc
<<<< END OF CODE <<<<

where @doc is the filename of our file on the LAN to be opened, and
@idoc is the handle to be created.

the error is:
XML parsing error: Invalid at the top level of the document.

Here is some of the XML Document saved on the LAN that should be

opened by sp_xml_preparedocument and prepared.

<?xml version="1.0" encoding="UTF-8" ?>
<xdata created_by="OSA" created_at="Thu Nov 13 11:33:33 EST 2003">
<rows row_count="1000">
<row>
<COL1>714761905</COL1>
<COL2>714761905</COL2>
<COL3>714761905</COL3>
</row>
</xdata>

Any advice or tips whould be very helpful...

thanks

Phil

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: JM | last post by:
I have a SP set up to take an input param and then fire the following sp_xml_preparedocument OPENXML (With a select statement) sp_xml_removedocument This works fine with the XML syntax that...
0
by: Tom | last post by:
Hi, I've got problems using ntext data in a stored procedure (SQL-Server 2000): create procedure testproc @xmldata ntext as declare @Param ntext
1
by: Piyoosh Rai | last post by:
I have been trying to handle XML DataSets and read them into tables in the SQL Server 2000. Every place I read about sp_xml_preparedocument it seems to me as if it is an in-built stored procedure...
6
by: Andrzej | last post by:
Used to read newsgroup for answers, now have to ask for them as well. I have an application (C#, .NET 1.1) that connects to local db on MSDE 2000 SP3a (using ADO from MDAC 2.71) on one side and...
0
by: BillB | last post by:
Hello, I have been looking for a C# example to call a SQL Stored Procedure and parse an XML doc (foo.xml). The Stored Procedure should have 3 ins and one out : IN Example: 1- blobtext ntext...
2
by: Shilpa | last post by:
Hi, I haev the following code: DECLARE @x xml SET @x=' <Root> <row id="1"><name>Larry</name><oflw>some text</oflw></row> <row id="2"><name>Joe</name></row> <row id="3" />
0
StarPilot
by: StarPilot | last post by:
In SQL Server I can pass an XML document into a sproc, run it through sp_xml_preparedocument and then use the OPENXML() function to use it in a query. For example: DECLARE @idoc int DECLARE @doc...
1
by: yingwen | last post by:
I have a xml similar like this: <Member ID="123"> <DateBorrowed>11-01-2006</DateBorrowed> <Book ID="222" Title="ABC"> <Category> Fiction</Category> </Book>...
5
by: emsik1001 | last post by:
I'm trying to upload XML into SQL Server 2000. I've never used openxml and I'm struggling with it. Below is the procedure with data. DECLARE @idoc int DECLARE @doc varchar (1000) SET @doc...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.