Welcome! Log In Create A New Profile

Advanced

Import xml to SQL Server via comand Windev

Posted by Jeremias 
Jeremias
Import xml to SQL Server via comand Windev
September 30, 2008 04:58PM
Hello,

I need to import XML data to SQL Server2005.
What line of code windev can use for that?



Michel Fages
Re: Import xml to SQL Server via comand Windev
September 30, 2008 05:36PM
Hi Jeremias,

Recently I had to make bulk inserts into a Sql Server 2005 database, I did this using the bcp command (launched automatically by the WinDev app). Afaik, bcp is able to parse XML files and insert data (you will have to use a format file + a data file). You will find more info on µsoft web site, or here : [www.mssqltips.com]

Regards,

Michel Fages
Paulo Oliveira
Re: Import xml to SQL Server via comand Windev
September 30, 2008 05:58PM
Check HImportXML
I din't test it with olebd but with nativeaccess it works.
Jeremias
Re: Import xml to SQL Server via comand Windev
September 30, 2008 06:42PM
Guys, Thank so much

Best Regards from Brazil
Ricardo
Re: Import xml to SQL Server via comand Windev
September 30, 2008 08:19PM
Please, can you explain to us how we can lauch bcp command in windev?

thank you!!!

Michel Fages
Re: Import xml to SQL Server via comand Windev
October 01, 2008 10:45AM
Hello,

Here is a part of the code which launches the BCP command :
---
lc_FormatFile = ".\pp1tprd.xml"
lc_DataFile = ".\pp1tprd.dat"
lc_ErrorFile = ".\pp1tprd.err"

lc_bcpCommand = StringBuild("bcp %1.PP1_SCHEMA1.PP1TPRD in ""%2"" -f ""%3"" -S %4 -U %5 -P %6 -h ""ROWS_PER_BATCH = 10000"" -e ""%7""", Base1, lc_DataFile, lc_FormatFile, Server1, User1, Password1, lc_ErrorFile)


IF NOT ExeRun(lc_bcpCommand, exeActive, True) THEN Error(ErrorInfo())

---

You find find informations about the content of the data and format files on µsoft's web site.

Michel Fages
Ben
Re: Import xml to SQL Server via comand Windev
October 01, 2008 10:57AM
HImportXML works with OLE DB. I used it on several instances without any issues. I wont say its efficient (Larger chunks takes time), but it never failed me so far.
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: