BULK INSERT data to myspecies
The following BULK INSERT
SQL statement:
- specifies the file format
- requires an absolute path to myspecies.csv (which can be altered to your system)
- maps each column of data in the CSV to the columns in the
myspecies
table.
Before you begin
Create a CSV data source
Create a CSV file with the following structure then save as */featurebase/import/myspecies.csv
A header row is not required because the BULK INSERT
statement defines the destination columns
"yes", "Manatee, Sea Horse, Koala"
"no", "Starfish"
BULK INSERT to myspecies
The MAP
clause always uses 0
to correspond to the table _id
unique identifier.
BULK INSERT INTO myspecies (_id, species)
MAP (0 string, 1 stringset)
FROM
'/home/myuser/featurebase/import/myspecies.csv'
WITH
FORMAT 'CSV'
INPUT 'FILE';