The Interactive SQL Import Wizard lets you choose a source and format, and a destination table, for the data. You can import data from TEXT and FIXED format files. You can choose to import this data into an existing table, or you can use the wizard to create and configure a completely new table. You can also use the Import Wizard to import data between:
Use the Interactive SQL Import Wizard when you:
This example shows you how to import data using the Interactive SQL Import Wizard.
To import data (Interactive SQL Data menu)
In Interactive SQL, from the Data menu choose Import.
Follow the instructions in the wizard.
This example adds data about an employee to the Employees table of the SQL Anywhere sample database.
To import data from a file into the SQL Anywhere sample database
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' |
In Interactive SQL, from the Data menu choose Import.
Select In A Text File and click Next.
In the File Name field, type import.txt.
Select In An Existing Table.
Select Employees and click Next.
In the Field Separator list, select Comma(,) and click Next.
Click Import.
Click Close.
The SQL statement created by the wizard is stored in the command history when the import finishes.
You can view the generated SQL statement; from the SQL menu, choose Previous SQL.
The IMPORT statement generated by the Import Wizard appears in the SQL Statements pane:
-- Generated by the Import Wizard INPUT INTO "GROUPO"."Employees" from 'C:\\Tobedeleted\\import.txt' FORMAT TEXT ESCAPES ON ESCAPE CHARACTER '\\' DELIMITED BY ',' ENCODING 'Cp1252' |
The following example shows you how to add a table from an UltraLite database to a SQL Anywhere database.
To import data from the SQL Anywhere sample database into an UltraLite database
Connect to an UltraLite database, such as, C:\Documents and Settings\All Users\Documents\SQL Anywhere 11\Samples\UltraLite\CustDB\custdb.udb
In Interactive SQL, from the Data menu choose Import.
Select In A Database and click Next.
From the Database Type list choose SQL Anywhere
On the Identification tab, select ODBC Data Source Name, type SQL Anywhere 11 Demo, and click Next.
Select Customers and click Next.
Select In A New Table, type dba and SQLAnyCustomers, for the Owner and Table Name respectively, and then click Import.
Click Close.
View the generated SQL statement; from the SQL menu, choose Previous SQL.
The IMPORT statement created and used by the Import Wizard appears in the SQL Statements pane.
-- Generated by the Import Wizard INPUT USING 'DSN=SQL Anywhere 11 Demo;CON=''''' FROM "GROUPO.Customers" INTO "dba"."SQLAnyCustomers" CREATE TABLE ON |
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |