Appending New Records (Cases)

To append new records (cases) to a database table:

  1. From the menus in the Data Editor window for the dataset that you want to use to add cases to the database table, choose:

    File > Export to Database

  2. Select the database source. See the topic Selecting a Data Source for more information.
  3. In the Choose how to export the data panel of the Export to Database Wizard, select Append new records to an existing table.
  4. In the Select a table or view panel, select the database table. See the topic Selecting a Table for more information.
  5. Match variables in the active dataset to table fields by dragging and dropping variables to the Source of values column.

The Export to Database Wizard will automatically select all variables that match existing fields, based on information about the original database table stored in the active dataset (if available) and/or variable names that are the same as field names. This initial automatic matching is intended only as a guide and does not prevent you from changing the way in which variables are matched with database fields.

When adding new records to an existing table, the following basic rules/limitations apply:

  • All cases (or all selected cases) in the active dataset are added to the table. If any of these cases duplicate existing records in the database, an error may result if a duplicate key value is encountered. For information on exporting only selected cases, see Selecting Cases to Export.
  • You can use the values of new variables created in the session as the values for existing fields, but you cannot add new fields or change the names of existing fields. To add new fields to a database table, see Adding New Fields.
  • Any excluded database fields or fields not matched to a variable will have no values for the added records in the database table. (If the Source of values cell is empty, there is no variable matched to the field.)

User-Missing Values

There are two options for the treatment of user-missing values when data from variables are exported to database fields:

  • Export as valid values. User-missing values are treated as regular, valid, nonmissing values.
  • Export numeric user-missing as nulls and export string user-missing values as blank spaces. Numeric user-missing values are treated the same as system-missing values. String user-missing values are converted to blank spaces (strings cannot be system-missing).