Import data with the Import Wizard (Interactive SQL)

Use the Interactive SQL Import Wizard to select a source, format, and destination table for the data. You can import data from text files, fix format files, and shapefiles. You can import data into an existing table or a new table.

Prerequisites

DBA authority.

Context and remarks

You can also use the Import Wizard to import data between:

  • databases of different types, such as between a SQL Anywhere database and an UltraLite database.

  • databases of different versions (as long as you have an ODBC driver for each database), such as between a SQL Anywhere 12 database and a SQL Anywhere 11 database.

Use the Interactive SQL Import Wizard when you:

  • want to create a table at the same time you import the data

  • prefer using a point-and click interface to import data in a format other than text

 Import data
  1. In Interactive SQL, click Data » Import.

  2. Follow the instructions in the Import Wizard.

 Import data from a file into the SQL Anywhere sample database
  1. Create and save a text file named import.txt with the following values (on a single line):

    100,500,'Chan','Julia',100,'300 Royal Drive',
    'Springfield','OR','USA','97015','6175553985',
    'A','017239033',55700,'1984-09-29',,'1968-05-05',
    1,1,0,'F'
  2. In Interactive SQL, click Data » Import.

  3. Click In A Text File and click Next.

  4. In the File Name field, type import.txt and click Next.

  5. Click In An Existing Table.

  6. Click Employees and click Next.

  7. In the Field Separator list, click Comma(,). Click Next.

  8. Click Import.

  9. Click Close.

    The SQL statements created by the wizard are stored in the History list when the import finishes.

    You can view the generated SQL INPUT statement; in the SQL menu, click Previous SQL.

    The INPUT statement generated by the Import Wizard appears in the SQL Statements pane:

    --  Generated by the Import Wizard
    input into "GROUPO"."Employees" from 'c:\\data\\import.txt' 
      format text escapes on escape character '\\' 
      delimited by ',' encoding 'Cp1252'
 Import data from the SQL Anywhere sample database into an UltraLite database
  1. Connect to an UltraLite database, such as, C:\Documents and Settings\All Users\Documents\SQL Anywhere 12\Samples\UltraLite\CustDB\custdb.udb.

  2. In Interactive SQL, click Data » Import.

  3. Click In A Database. Click Next.

  4. In the Database Type list, click SQL Anywhere.

  5. In the Action dropdown list, click Connect With An ODBC Data Source.

  6. Click ODBC Data Source Name, and then type in the box below, SQL Anywhere 12 Demo.

  7. Click Next.

  8. In the Table Name list, click Customers. Click Next.

  9. Click In A New Table.

  10. In the Table Name field, type SQLAnyCustomers.

  11. Click Import.

  12. Click Close.

  13. To view the generated SQL statement, click SQL » Previous SQL.

    The INPUT statement generated by the Import Wizard appears in the SQL Statements pane.

    --  Generated by the Import Wizard
    INPUT USING 'DSN=SQL Anywhere 12 Demo;CON=''''' 
    FROM "GROUPO.Customers" INTO "dba"."SQLAnyCustomers" 
    CREATE TABLE ON

Results

The data is imported into the specified database.

Next

None.