I have a simple SQL query that is suppose to get the data from .csv file and insert or update the data in the table
import from /home/AssetAllocation/labels.csv of del insert_update into labels
I am trying to run the query in IBM Data Studio but am getting a compile error on the import, of and del. How do I fix query to get no compile errors?
You can't execute the
IMPORT
command directly within Data Studio, becauseIMPORT
is a DB2 CLP command, not an SQL statement.If you must use Data Studio, then the data file you want to import must reside on the database server. There are 2 ways to do this:
You can use it with the
ADMIN_CMD()
stored procedure (this requires that the file you want to load reside on the database server itself, though).You can right-click on a table name in Data Studio and click the "Load" option and then choose "With Import Utility". This will actually open an
ssh
session to your server to perform the import.If you have the DB2 Data Server Client on your PC this may be the easiest way, as you can start a DB2 Command Line Processor (CLP) window and execute the
IMPORT
command that you were trying to execute to begin with.