Importing Data from CSV Files
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 ZooDBConnect data source to connect to it.
2.Do one of the following:
•Click the 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 next to the Path, and browse for the file C:\Users\<username>\Documents\Altova\DatabaseSpy2025\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 until it changes to the symbol for a column not to be imported . 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.
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.
9.Click the Execute 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).