Populating Other Tables (Optional)
In the previous steps of this tutorial, you have imported data into the database from a text file as well as from an XML file. This has populated the tblZookeepers and tblFeedSuppliers tables with data.
Optionally, to populate the remaining database tables with data, run an import from the following text or XML files available in the C:\Users\<username>\Documents\Altova\DatabaseSpy2024\DatabaseSpyExamples\Tutorial folder. For each table, you should import data from either the CSV or the XML file (not both).
Note that the source files contain foreign key values that are supposed to exist in the target database tables at the time of import. For example, table tblAnimals must be populated before tblMedicalTreatments, because one cannot add a medical treatment record for an animal ID that does not exist yet in the database. Therefore, for the import to be successful, make sure that:
1.The files are imported in the order shown above.
2.No data has been previously added or deleted from the destination table (in other words, the table must have an identity value of 0).
If you discover that the import fails due to foreign key constraint violations, it is likely that data has already been added or deleted in the table. To remedy this, delete all data from the table, reset the identity value to 0, and then perform the import again. The following code listing shows how to reset the identity value of a SQL Server table to 0:
DBCC CHECKIDENT ('tblVeterinarians', RESEED, 0);