Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Usage » Importing and Exporting Data » Importing data

Handling conversion errors during import Next Page

Importing tables

You can import tables into an existing database using either the Interactive SQL Data menu or the SQL Statements pane. The table data can be in text, DBASEII, Excel 2.1, FOXPRO, and Lotus formats.

To import a table (Interactive SQL Data menu)
  1. Ensure that the table you want to place the data in exists.

  2. From the Data menu, choose Import.

    The Open dialog appears.

  3. Locate the file you want to import and click Open. The file extension must be one of those recognized by the Import wizard

    The Import wizard appears.

  4. Select the Use an Existing Table option and enter the name of the table in the field.

  5. Follow the remaining instructions in the wizard.

    If the import is successful, the Messages tab displays the amount of time it to took to import the data and the number of rows inserted. If the import is unsuccessful, a message appears indicating that the import was unsuccessful. The Results tab in the Results pane displays the contents of the table.

To import a table (Interactive SQL Statements pane)
  1. Use the CREATE TABLE statement to create the destination table. For example:

    DepartmentID          integer NOT NULL,
    DepartmentName        char(40) NOT NULL,
    DepartmentHeadID      integer NULL,
    CONSTRAINT DepartmentsKey PRIMARY KEY (DepartmentID)

    For more information, see CREATE TABLE statement.

  2. Execute a LOAD TABLE statement. For example,

    LOAD TABLE Departments
    FROM 'departments.csv'
  3. To keep trailing blanks in your values, use the STRIP OFF clause in your LOAD TABLE statement. The default setting (STRIP ON) strips trailing blanks from values before inserting them.

    The LOAD TABLE statement adds the contents of the file to the existing rows of the table; it does not replace the existing rows in the table. You can use the TRUNCATE TABLE statement to remove all the rows from a table.

    Neither the TRUNCATE TABLE statement nor the LOAD TABLE statement fires triggers, including referential integrity actions, such as cascaded deletes.

For more information about the LOAD TABLE statement syntax, see LOAD TABLE statement.

Table structures for import
Merging different table structures
Importing binary files