Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 sp_xml_preparedocument error

Author  Topic 

magmo
Aged Yak Warrior

558 Posts

Posted - 2006-12-09 : 07:54:16
Hi


I have this stored procedure that must have some faults in it beacuse I get this error message when I try to run it..

Error message..

The XML parse error 0xc00ce502 occurred on line number 1, near the XML text "<ROOT><ARTICLES><ARTICLE TiltID=2 MastID=2 MastLiftID=2 CapacityID=3 /></ARTICLES></ROOT>".
Msg 6602, Level 16, State 2, Procedure sp_xml_preparedocument, Line 1
The error description is 'A string literal was expected, but no opening quote character was found.'.
Msg 8179, Level 16, State 5, Procedure p_BulkInsertTiltValues, Line 14
Could not find prepared statement with handle 0.
The statement has been terminated.
Msg 6607, Level 16, State 3, Procedure sp_xml_removedocument, Line 1
sp_xml_removedocument: The value supplied for parameter number 1 is invalid.


My stored procedure...

p_BulkInsertTiltValues 
(@ArticleData ntext)
AS
DECLARE @hDoc int
exec sp_xml_preparedocument @hDoc OUTPUT,@ArticleData
BEGIN
SET NOCOUNT ON;
INSERT INTO tbl_TiltValue_Association(TiltID, MastID, MastValueID, CapacityID)
SELECT *
FROM OPENXML(@hDoc, 'ROOT/ARTICLES/ARTICLE',1)
WITH ( TiltID Int , MastID Int, MastLiftID Int, CapacityID Int ) XMLEmp
EXEC sp_xml_removedocument @hDoc
END



And this is what I insert..

Exec p_BulkInsertTiltValues '<ROOT><ARTICLES><ARTICLE TiltID=2 MastID=2 MastLiftID=2 CapacityID=3 /></ARTICLES></ROOT>'


What am I doing wrong here?


Regards

magmo
Aged Yak Warrior

558 Posts

Posted - 2006-12-09 : 09:16:14
No need to reply, I found the error.
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2006-12-09 : 10:08:13
I'll reply anyway for benefit of others, since you didn't say what caused the error:

your attribute values in the xml need to be in quotes.


http://www.elsasoft.org
Go to Top of Page

magmo
Aged Yak Warrior

558 Posts

Posted - 2006-12-09 : 10:27:17
Sorry about that, youre absolutly right
Go to Top of Page
   

- Advertisement -