Home All Groups Group Topic Archive Search About

Re: help with OPENXML

Author
6 Dec 2004 11:31 PM
Michael Rys [MSFT]
Hi Bernard

What are the schemas of your relational tables?

Since you get the rows, your path expressions find the nodes that map to
rows, but it looks like that the relative paths implied by the relational
schema does not find any values for the nodes where you get NULL.

This probably means that your Schema names and attribute names do not fit.

Best regards
Michael

Show quote
"Bernard" <bern***@form.hr> wrote in message
news:cm0576$r2e$1@ls219.htnet.hr...
> OK, thanks! It works with nText type, but I have some other problem.
>
> With this procedure:
> --------------------------------------------------------------------------------
> CREATE PROC sp_insert_BGListaIzvj @strXML nText
> AS
>
> DECLARE @hDoc int
>
> EXEC sp_xml_preparedocument @hDoc OUTPUT, @strXML
>
>
>
> INSERT INTO BGListaIzvj
>
> SELECT *
>
> FROM OPENXML(@hDoc, '/ROOT/BGListaIzvj')
>
> WITH BGListaIzvj
>
>
>
> INSERT INTO BGIzvj
>
> SELECT *
>
> FROM OPENXML(@hDoc, '//BGIzvj')
>
> WITH BGIzvj
>
>
>
> EXEC sp_xml_removedocument @hDoc
>
> GO
>
> --------------------------------------------------------------------------------
>
>
>
> and this XML file:
>
> --------------------------------------------------------------------------------
>
> <?xml version="1.0" standalone="yes"?>
>
> <ROOT>
>
>  <BGListaIzvj ListaIzvjID="16" FirmaID="13" BlgID="7" RedBroj="1"
> Razdoblje="01.01.2004 do 31.01.2004" PocStanje="328.79" ZavStanje="143.18"
> Fin="1" Godina="2004" Mjesec="01.2004" Sn="0">
>
>    <BGIzvj ListaIzvjID2="16" BlgID2="7" Datum="2004-01-07T00:00:00"
> Primljen="-" Opis="plaæa za 12/03 za Amaliju Cigler" Dokum="Upl1"
> Konto="1009" Duguje="222.4" Potrazuje="0" U="Zagreb" Jed="0" Odj="0"
> Tip="U" BR="1" Godina2="2004" />
>
>    <BGIzvj ListaIzvjID2="16" BlgID2="7" Datum="2004-01-07T00:00:00"
> Primljen="Ljubomir Babiæ" Opis="plaæa za Amaliju Cigler 12/03"
> Dokum="Ispl1" Konto="2304" Duguje="0" Potrazuje="222.4" U="Zagreb" Jed="3"
> Odj="0" Tip="I" BR="1" Godina2="2004" />
>
>  </BGListaIzvj>
>
>  <BGListaIzvj ListaIzvjID="17" FirmaID="13" BlgID="7" RedBroj="2"
> Razdoblje="01.06.2004 do 30.06.2004" PocStanje="143.18"
> ZavStanje="1797.79" Fin="1" Godina="2004" Mjesec="06.2004" Sn="0">
>
>    <BGIzvj ListaIzvjID2="17" BlgID2="7" Datum="2004-06-15T00:00:00"
> Primljen="gotovina" Opis="mat. tro¹kove i isplata PN" Dokum="Upl2"
> Konto="1009" Duguje="15000" Potrazuje="0" U="Zagreb" Jed="0" Odj="0"
> Tip="U" BR="2" Godina2="2004" />
>
>    <BGIzvj ListaIzvjID2="17" BlgID2="7" Datum="2004-06-30T00:00:00"
> Primljen="Ljubomir Babiæ" Opis="PN 3,4,5,7 -dnevnice" Dokum="Ispl5"
> Konto="4600" Duguje="0" Potrazuje="595" U="Zagreb" Jed="3" Odj="0" Tip="I"
> BR="5" Godina2="2004" />
>
>  </BGListaIzvj>
>
> </ROOT>
>
> --------------------------------------------------------------------------------
>
>
>
> I get rows in second table (BGIzvj) with NULL values in columns
> ListaIzvjID, BlgID and Godina. These three tables are the same as in
> BGListaIzvj table. Is that a problem? Is there way to fix this??
>
>
>
> Thanks!
>
>
>
>
>
>

AddThis Social Bookmark Button