Importing Data
You can import data into SQLScope from another data source by using the Insert command. Before completing the following exercises, you must import data into the tables you created. The example given in this section will step you through the process.
Syntax:
Insert
into tablename
(fieldname,
fieldname, fieldname)
Values
(@fieldname,
@fieldname, @fieldname);
Explanation:
- Before you can import, you must create a data file in one
of the following formats:
- Btreive unformatted (.unf) -- File layout.
- Logical, date, and time fields are in binary format.
- Each row is preceded by its length, followed by a comma.
- Each row is terminated with a carriage return.
- Standard Data Format (.sdf) -- File layout.
- All data is represented in ASCII characters.
- A comma is used to separate fields.
- Character fields are enclosed in double quotes.
- Each row is terminated with a carriage return.
- ASCII
- Each row is preceded by a comma or a space.
- Each field and each row is a specified length.
- Each row is terminated with a carriage return.
- DIF (.dif)
- Each file is made up of two sections: header and data.
- Each row has a standard length.
- Each field has a standard length.
- Btreive unformatted (.unf) -- File layout.
- The Values clause is used to specify substitution variables.
- Substitution variables must be preceded by an @ sign.
- Each field in the Insert statement must be in the same order as the corresponding field in the data file.
To import data:
Choose Import from the File menu to open the Import dialog box.
- In the File Type box, specify the type of file you want to import.
- In the Drive box, specify the appropriate drive.
- In the Directories box, specify the appropriate directory.
- In the File Name box, specify the name of the file from which to import.
- If you would like the process to run in the background while you continue working, click on the Background field.
- Click on Import to begin the import process.
Import data into the TrnVendor and TrnAPDoc files.
- Download the files:
Click here to download a zip.file
- Type the following in the SQL text box:
Insert into TrnVendor
(Vendid, Name, Add1, City, State, CurrBal, ExpAcct )
Values
(@Vendid, @Name, @Add1, @City, @State, @CurrBal, @ExpAcct)
- Click on File on the Menu bar.
- Click on Import on the drop-down menu to open the Import dialog box.
- In the Drive box, specify the drive to which you downloaded the files in step #1.
- In the Directories box, specify the directory to which you downloaded the files in step #1.
- In the File Name field, type imvendor.sdf.
- Click on Import.
- You should receive the following message:
Importing has completed.
Records: 30
- Type the following in the SQL Text box:
Insert into TrnAPDoc
(Vendid, RefNbr, DocDate, OrigDocAmt, CuryDocBal, OpenDoc)
Values
(@Vendid, @RefNbr, @DocDate, @OrigDocAmt, @CuryDocBal, @OpenDoc)
- Click on File on the Menu bar.
- Click on Import on the drop-down menu to open the Import dialog box.
- In the Drive box, specify the drive to which you downloaded the files in step #1.
- In the Directories box, specify the directory to which you downloaded the files in step #1.
- In the File Name field, type imapdoc.sdf.
- Click on Import.
- You should receive the following message:
Importing has completed.
Records: 50
Table of Contents |