parse XML larger than 8000 characters

From: Peter Durica (Durica_at_discussions.microsoft.com)
Date: 08/23/04


Date: Mon, 23 Aug 2004 03:11:01 -0700

i'm parsing XML from table text field into another table, everything is
working ok until XML is longer than 8000 characters:

code sample:

declare @idoc int
declare @doc varchar(8000)
declare @xmlguid uniqueidentifier
declare @procguid uniqueidentifier
declare xml_cur cursor for select DataDocumentXmlGuid, ProcessEngineGuid,
        DataDocumentXML from cref2
        where DataDocumentID = 'SSVData'

declare @pomocna int
set @pomocna = 0
open xml_cur
fetch next from xml_cur into @xmlguid, @procguid, @doc
set @doc = replace(@doc, 'utf-8', 'windows-1250')
while @@fetch_status=0
begin
        set @pomocna = @pomocna + 1
        exec sp_xml_preparedocument @idoc OUTPUT, @doc
        INSERT SSV_data
        SELECT @xmlguid, @procguid, *
        FROM OPENXML (@idoc, '/SSVData/SSVAppData')
        WITH (
        SSVApplicationNo char(15) '@SSVApplicationNo',
        SSVUserID varchar(20) '@SSVUserID',
        SSVCostCenterID char(5) '@SSVCostCenterID')

        exec sp_xml_removedocument @idoc
        fetch next from xml_cur into @xmlguid, @procguid, @doc
        set @doc = replace(@doc, 'utf-8', 'windows-1250')
        print @pomocna

end
close xml_cur
deallocate xml_cur

Is it possible to split XML into 2 varchar(8000) and parse it as one XML?

thanks



Relevant Pages

  • can openxml write multiple fields - 1 row?
    ... quantity attributes from the XML document. ... declare @doc varchar ... FROM OPENXML ... This routine only generates one int ...
    (microsoft.public.sqlserver.xml)
  • Re: How Can I read this XML
    ... Did you look at SQL Books Online for OPENXML? ... declare @idoc int ... declare @doc varchar ... > I want to use SQL Server to read this XML and copy data in to DB. ...
    (microsoft.public.sqlserver.xml)
  • Re: XML performance extremely slow for no obvious reason
    ... But XML is also an issue, because there, too, ... the optimizer can't deal, but you can do less about it, I think. ... Though there's a nested loop join shown, ... declare @ids varbinary ...
    (microsoft.public.sqlserver.xml)
  • can openxml write multiple fields - 1 row?
    ... I got an xml routine from the Sql Server NG where I can ... delimiters in the string. ... Declare @iDoc Int ...
    (microsoft.public.sqlserver.xml)
  • Re: Shredding XML
    ... to determine which field values should be extracted from an XML doc ... The stored procedure works, but the process of dynamically gathering ... DECLARE keycolumns_cursor CURSOR LOCAL ... DECLARE @xPath varchar ...
    (microsoft.public.sqlserver.xml)

Loading