Altova DatabaseSpy 2024 Professional Edition

In addition to importing data from CSV files, you can also import data from XML files. In this tutorial step, you will import data from an XML file into the tblFeedSuppliers database table.

To import data:

1.Open the "ZooDB" project created previously and double-click the dbs_ic_connected ZooDBConnect data source to connect to it.

2.Do one of the following:

 

Click the Import ic_import toolbar button.

On the Tools menu, click Import data to the database.

Press Ctrl+I.

 

3.A dialog box appears. Click the XML button on the left side of the dialog box.

4.Click ic_browse next to the Path, and browse for the file C:\Users\<username>\Documents\Altova\DatabaseSpy2024\DatabaseSpyExamples\Tutorial\dbo.tblFeedSuppliers.xml.

5.Under Database Generation Options, select Update existing tables.

6.Under Import Mode, select Generate SQL in SQL Editor.

7.Click the Options tab.

8.Under Start point of import, in the "Starting from" list, select "Row". (This specifies the name of the XML element from which data will be imported).

9.Under Automatic fields, click to clear the Create primary/foreign keys check box.

10.Under Other options, select Exclude namespace name.

11.Under Preview, click the Reload button. This displays table data in the Preview window.

12.Click inside the "Target Table Name" column and choose dbo.tblFeedSuppliers from the drop-down list.

13.Click the SupplierID column ic_include-col until it changes to the symbol for a column not to be imported ic_exclude-col. The column header allows you to define whether it should be included during the import process. We will not import the SupplierID column since this is an identity column and the primary key will be generated automatically during import.

dbs_zoo_tutorial_import_xml_01

14.Click the Generate SQL button. This creates an SQL script which can be executed to complete the import process.

dbs_zoo_tutorial_import_xml_02

15.Click the Execute ic_execute-sql button or press F5.

 

To view the imported data, right-click the tblFeedSuppliers table in the Online Browser and select Retrieve data | All rows from the context menu (alternatively, press Ctrl+Alt+R).

dbs_zoo_tutorial_import_xml_03

© 2017-2023 Altova GmbH