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


Querying XML files using SQL 2000


Querying XML files using SQL 2000

Author
Message
David.Poole
David.Poole
SSCertifiable
SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)

Group: General Forum Members
Points: 7476 Visits: 3282
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/dpoole/queryingxmlfilesusingsql2000.asp

LinkedIn Profile

Newbie on www.simple-talk.com
David.Poole
David.Poole
SSCertifiable
SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)

Group: General Forum Members
Points: 7476 Visits: 3282
Oh the embarrassment!!!!

Thanks to Carsten Dauguaard for spotting it.

In the code for the stored procedure

exec sp_xml_preparedocument @iDocumentHandle OUTPUT, @stdoc

should be

exec sp_xml_preparedocument @iDocumentHandle OUTPUT, @stXML

This is what you get when you copy a stored proc into Word, save it as html then edit the html in notepad!

LinkedIn Profile

Newbie on www.simple-talk.com
David.Poole
David.Poole
SSCertifiable
SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)

Group: General Forum Members
Points: 7476 Visits: 3282
Oh the embarrassment, thanks to Carsten Dauguaard for spotting it.

exec sp_xml_preparedocument @iDocumentHandle OUTPUT, @stdoc

should be

exec sp_xml_preparedocument @iDocumentHandle OUTPUT, @stXML

LinkedIn Profile

Newbie on www.simple-talk.com
ckempste
ckempste
Ten Centuries
Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)

Group: General Forum Members
Points: 1353 Visits: 1
Great article !


Chris Kempster
www.chriskempster.com
Author of "SQL Server Backup, Recovery & Troubleshooting"
Author of "SQL Server 2k for the Oracle DBA"
ckempste
ckempste
Ten Centuries
Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)

Group: General Forum Members
Points: 1353 Visits: 1
Hi

One question:

WARNING: - This will use 1/8th of the memory available to SQL Server.

So, we open up 10 4kb documents it will do what to memory?? and what memory structure are we talking about?

Cheers

Ck


Chris Kempster
www.chriskempster.com
Author of "SQL Server Backup, Recovery & Troubleshooting"
Author of "SQL Server 2k for the Oracle DBA"
David.Poole
David.Poole
SSCertifiable
SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)

Group: General Forum Members
Points: 7476 Visits: 3282
Books on line says "A parsed document is stored in the internal cache of SQL Server 2000. The MSXML parser uses one-eighth the total memory available for SQL Server. To avoid running out of memory, run sp_xml_removedocument to free up the memory.".

Although it makes reference to the XML Parser but it is not crystal clear whether this means there is a 1/8th penalty overall for using the XML parser or 1/8th per document.

I haven't had chance to test it in anger because the CMS we are developing on has a memory leak (more of a terminal gush) in its implementation of DOM so I've had to revert to itterating through a normal recordset building up the XML as a text string.

Which ever scenario is used the guideline I would suggest is to use the sp_xml_removedocument as soon as humanly possible.

LinkedIn Profile

Newbie on www.simple-talk.com
mo ordi
mo ordi
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 1
great article but my question is: where do you specify the pad to your XML file
meherkn
meherkn
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 35

What do we do if the XML to be processed is more than 8000 characters? Do we wait for SQL Sever 2005 for next generation of XML- SQL usage?





SAinCA
SAinCA
SSC-Enthusiastic
SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)

Group: General Forum Members
Points: 190 Visits: 695

In case anyone is still watching this thread...

I come from the "validate all input" school, especially when a "blind" SP is called from who knows where. Does anyone have any guidance in SS2K on validating the elements in the document before hitting an exception for a "bad date" or "number too large for destination data type" issue? I've worked out a really clunky way using OPENXML into nvarchar fields, then validate, then parse again into typed fields when the entire doc is valid, but there must be something better


ypavani_apps
ypavani_apps
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 2
where do i store XML file
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