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

SQL Anywhere 12.0.1 » SQL Anywhere Server - SQL Usage » Remote data and bulk operations » Data import and export » Data import


Importing tables

You can use Interactive SQL to import data from a text file, another table in any database, or a shape file, into a table in your database.



Context and remarks


 Import a table (Interactive SQL Import Wizard)
  1. Ensure that the table you want to place the data in exists.

  2. In Interactive SQL, in the Data menu click Import.

  3. Click In A Text File and click Next.

  4. In the File Name field, click Browse to add the file.

  5. Click In An Existing Table.

  6. Click Next.

  7. For ASCII files, specify the way the ASCII file is read and click Next.

  8. Click Import.

  9. Click Close.

 Import a table (SQL)
  1. Use the CREATE TABLE statement to create the destination table. For example:

    CREATE TABLE GROUPO.Departments (
    DepartmentID          integer NOT NULL,
    DepartmentName        char(40) NOT NULL,
    DepartmentHeadID      integer NULL,
    CONSTRAINT DepartmentsKey PRIMARY KEY (DepartmentID) );
  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 or perform referential integrity actions, such as cascaded deletes.


The data is imported into the specified table.



 See also