SQL DB2 Bulk update from csv
I get emailed an excel spreadsheet with 4 columns. The first column is (ID) and the 4th is the (Model#). Is there a way in DB2 to bulk update?
Something like
开发者_JAVA技巧Update (Table)
set Model# = (Model#)
where ID = (ID)
DB2 has Import, but not quite what I'm looking for.
IMPORT FROM my_file.csv
OF del
METHOD P(2, 3, 5)
INSERT INTO my_table(my_column_2, my_column_3, my_column_5)
4Did you read the documentation for the IMPORT command?
You can use INSERT_UPDATE to update rows where the primary key value matches the data in the CSV file:
IMPORT FROM my_file.csv
OF del
METHOD P(1, 4)
INSERT_UPDATE INTO my_table(my_column_1, my_column_4)
This assumes that my_column_1 is the primary key in the table…
精彩评论