/*written by Michael Matschiner, 05/26/2009*/ /*send feedback to michael.matschiner-at-unibas.ch*/ /*This code is intended for import of data into the 'station' table of the MySQL database 'gene_sample' running on evo-lutra.zoo.unibas.ch. Data is imported from the file addToStation.csv, which needs to be correctly formatted for successful import. A template Excel file with individual sheets for every database table can be found at www.evolution.unibas.ch/salzburger/protocols.htm. You'll need to save the respective sheet in csv format and change the filename specified below accordingly.*/ LOAD DATA LOCAL INFILE "/Users/michaelmatschiner/Documents/addToStation.csv" INTO TABLE station FIELDS TERMINATED BY "," ENCLOSED BY "\"" LINES TERMINATED BY "\r" IGNORE 5 LINES (name, location, latitude, longitude, min_water_depth, max_water_depth, mean_water_depth, @date_visited, sampling_method, @field_trip.name) SET field_trip_id = (SELECT id FROM field_trip WHERE name = @field_trip.name), date_visited = str_to_date(@date_visited,'%Y-%m-%d')