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 » Import tools

Using the LOAD TABLE statement to import data Next Page

Using the INSERT statement to import data


The INSERT statement lets you add rows to the database. Because you include the import data for your destination table directly in the INSERT statement, it is considered interactive input. You can also use the INSERT statement with remote data access to import data from another database rather than a file.

Use the INSERT statement to import data when you:

For more information, see INSERT statement.

Impact on the database

Changes are recorded in the transaction log when you use the INSERT statement. This means that if there is a media failure involving the database file, you can recover information about the changes you made from the transaction log.

For more information, see The transaction log.

Example

This example shows you how to import data using the INSERT statement. With this INSERT statement, you add data to the Departments table of the SQL Anywhere sample database.

To import data (INSERT statement)
  1. Ensure that the destination table exists.

  2. Execute an INSERT statement. For example,

    The following example inserts a new row into the Departments table in the SQL Anywhere sample database.

    INSERT
    INTO Departments ( DepartmentID, DepartmentName, DepartmentHeadID )
    VALUES ( 700, 'Training', 501)
    SELECT * FROM Departments;

    Inserting values adds the new data to the existing table.