Altova DatabaseSpy 2024 Enterprise Edition

DatabaseSpy provides an import function which allows you to insert data from comma-separated value (CSV) files into a database. In this tutorial step, you will import data from the tblZookeepers.txt file into the database table tblZookepers.

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 CSV 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\tblZookeepers.txt.

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

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

7.Click the ZookID 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 the field's key type, and also if it should be included during the import process. We will not import the ZookID column since this is an identity column and the primary key will be generated automatically during import.

dbs_zoo_tutorial_import_csv_01

8.Click the Generate SQL button. This creates an SQL script which can be executed to complete the import process. Notice that the ZookID column is not included in the script, because it was specifically excluded in a previous step.

dbs_zoo_tutorial_import_csv_02

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

 

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

dbs_zoo_tutorial_import_csv_03

© 2017-2023 Altova GmbH