Sybase – How to INSERT Values from .csv into Database

sybase

We have a sybase database running an application our users use which contains client info.

The situation is that address information for maybe 1000 clients or so is out of date. We were given a .csv file with updated address info, and are being asked to update the addresses in the database.

I've filtered the csv to compare the 2 address columns and only show those that are not the same. So I have a .csv containing only the clients who need their address updated.

So imagine this client information lives on a table. We also have unique client ID's to go by along with other personal info found on the client table.

I'm no SQL expert, so my query syntax for sql is probably way off, but does anybody have any suggestions for how I might write a query for this?

Something like,

INPUT FOR EACH [client_id in .csv column A] [address_info in .csv column B] TO clientAddress.table

That's how I imagine it would work in my head anyway. I tried searching around but can't find anybody with a situation similar enough to mine.

Best Answer

USING FILE clause is used to load data from a file. The column list shows two columns to be imported from the .csv file.

LOAD TABLE clientAddress.table (client.id, address.info) 
USING CLIENT FILE 'file.csv'