You can import tables into an existing database using either the Interactive SQL Data menu or the SQL Statements pane.
To import a table (Interactive SQL Data menu)
Ensure that the table you want to place the data in exists.
In Interactive SQL, from the Data menu choose Import.
Select In A Text File and click Next.
In the File Name field, click Browse to add the file.
Select In An Existing Table.
Click Next.
For ASCII files, specify the way the ASCII file is read and click Next.
Click Import.
Click Close.
To import a table (Interactive SQL SQL Statements pane)
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) ); |
Execute a LOAD TABLE statement. For example,
LOAD TABLE Departments FROM 'departments.csv'; |
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.
Table structures for import
Merging different table structures
Importing binary files
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |