Querying XML files using SQL 2000

  • David.Poole

    SSC Guru

    Points: 75396

    Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/dpoole/queryingxmlfilesusingsql2000.asp

  • David.Poole

    SSC Guru

    Points: 75396

    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!

  • David.Poole

    SSC Guru

    Points: 75396

    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

  • ckempste

    SSCoach

    Points: 17983

    Great article !


    Chris Kempster
    www.chriskempster.com
    Author of "SQL Server Backup, Recovery & Troubleshooting"
    Author of "SQL Server 2k for the Oracle DBA"

  • ckempste

    SSCoach

    Points: 17983

    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

    SSC Guru

    Points: 75396

    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.

  • mo ordi

    Newbie

    Points: 9

    great article but my question is: where do you specify the pad to your XML file

  • meherkn

    Grasshopper

    Points: 23

    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

    SSCrazy

    Points: 2101

    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

    Grasshopper

    Points: 21

    where do i store XML file

  • tomailback

    Grasshopper

    Points: 17

    Greate article, but I have to insert my xml file into the code! How do I manage it to read the file from the hard drive??? That's much more important for me!

    Thank you very much!

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply