Welcome! Log In Create A New Profile

Advanced

SQL server question

Posted by wduser 
SQL server question
June 03, 2019 03:54PM
Hi

This is maybe a bit off topic but Iam a bit desperate . So I thought lets ask this question here. As there are many windev developers wordk with sel server as well.

Ok I would like to import an xml file into sql-server. This is done in sql-server it self because I have to import a huge number of xml files ( 9 million records) With widev this is easily done but takes ages to finnish . So it has to be done on the server . As a stored procedure. But first I have to make it work in management studio.

The xml is the Dutch addresse file from BAG. ( Kadaster) .

The problem is the fact that it, the xmpl file , has namespases. . Importing without namespaces is easy , there are lots things on the internet on than

My code so far:


use cowineWA
declare @x xml

select @x=p
From openrowset(Bulk 'c:\AddressImport\9999ADR07052019-01052019-000001.xml', SINGLE_BLOB )AS Address(p)

declare @hdoc int
EXEC sp_xml_preparedocument @hdoc OUTPUT, @x,'<root xmlns:bc-adres>'


select *
from openxml(@hdoc,'/bc_adres_LVC',1)
WITH (

huisnummer Varchar (10),
postcode Varchar (10)


)

EXEC sp_xml_removedocument @hdoc


The xml file ==> format

<bc-adres:BCAdresProduct xmlns:xsi="[www.w3.org]; xmlns:xs="[www.w3.org]; xmlns:bc-adres="[www.kadaster.nl]; xmlns:bc_adres_LVC="[www.kadaster.nl]; xmlns:bagtype="[www.kadaster.nl]; xmlns:nen5825="[www.kadaster.nl]; xsi:schemaLocation="[www.kadaster.nl] BagvsCompactAdresProduct-0.8.xsd">
<bc-adres:BCAdres>
<bc_adres_LVC:BCNummeraanduiding>
<bc_adres_LVC:identificatie>0532200000000003</bc_adres_LVC:identificatie>
<bc_adres_LVC:huisnummer>1</bc_adres_LVC:huisnummer>
<bc_adres_LVC:postcode>1611ZP</bc_adres_LVC:postcode>
<bc_adres_LVC:typeAdresseerbaarObject>Verblijfsobject</bc_adres_LVC:typeAdresseerbaarObject>
</bc_adres_LVC:BCNummeraanduiding>
<bc_adres_LVC:BCOpenbareRuimte>
<bc_adres_LVCyawning smileypenbareRuimteNaam>Hugo de Grootsingel</bc_adres_LVCyawning smileypenbareRuimteNaam>
</bc_adres_LVC:BCOpenbareRuimte>
<bc_adres_LVC:BCWoonplaats>
<bc_adres_LVC:identificatie>1102</bc_adres_LVC:identificatie>
<bc_adres_LVC:woonplaatsNaam>Bovenkarspel</bc_adres_LVC:woonplaatsNaam>
</bc_adres_LVC:BCWoonplaats>
<bc_adres_LVC:aanduidingRecordInactief>N</bc_adres_LVC:aanduidingRecordInactief>
<bc_adres_LVC:inOnderzoek>N</bc_adres_LVC:inOnderzoek>
<bc-adres:tijdvakgeldigheid>
<bagtype:begindatumTijdvakGeldigheid>2019022600000000</bagtype:begindatumTijdvakGeldigheid>
</bc-adres:tijdvakgeldigheid>
<bc_adres_LVC:AdresseerbaarobjectKoppeling>
<bc_adres_LVC:aanduidingHoofdadres>J</bc_adres_LVC:aanduidingHoofdadres>
<bc_adres_LVC:BCVerblijfsobject>
<bc_adres_LVC:identificatie>0532010000003850</bc_adres_LVC:identificatie>
<bc_adres_LVC:gebruiksdoelVerblijfsobject>woonfunctie</bc_adres_LVC:gebruiksdoelVerblijfsobject>
</bc_adres_LVC:BCVerblijfsobject>
</bc_adres_LVC:AdresseerbaarobjectKoppeling>
<bc-adresangry smiley-coordinaat>145476</bc-adresangry smiley-coordinaat>
<bc-adres:Y-coordinaat>522475</bc-adres:Y-coordinaat>
</bc-adres:BCAdres>
<bc-adres:BCAdres>
Re: SQL server question
June 03, 2019 04:56PM
Hi,

Sorry, I can't answer your question directly, but have you seen this thread on StackOverflow?

[stackoverflow.com]

Regards,
Darren.
King
Re: SQL server question
June 05, 2019 03:00PM
Hello

Try this link to see if works for you:

[docs.microsoft.com]

HTH

King
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: