Hello all, I have an automated process that usually works, but occasionally it doesn't. I'm using the query below to load data hourly into a MySQL table from a tab-delimited file.
Most of the time it works fine, but every once in a while the complete file does not load. When that happens I go to my batch file and run it, and that fixes it up. Obviously I would rather have it run correctly every time so I don't have to worry about it. Any ideas what might be wrong here?
Most of the time it works fine, but every once in a while the complete file does not load. When that happens I go to my batch file and run it, and that fixes it up. Obviously I would rather have it run correctly every time so I don't have to worry about it. Any ideas what might be wrong here?
Code:
DROP TABLE IF EXISTS departments;
CREATE TABLE departments
(
pk_mysql_depts_id INT(20) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (pk_mysql_depts_id),
c_admin_asst_name VARCHAR(255) default '0',
c_admin_asst_phone VARCHAR(255) default '0',
c_admin_asst_status VARCHAR(255) default '0',
c_count_dept_id VARCHAR(255) default '0',
c_dept_alpha VARCHAR(255) default '0',
c_director_name VARCHAR(255) default '0',
c_leader_cpr VARCHAR(255) default '0',
c_leader_email VARCHAR(255) default '0',
c_leader_gender_status VARCHAR(255) default '0',
c_leader_image_url VARCHAR(255) default '0',
c_leader_image_url_af VARCHAR(255) default '0',
c_leader_last_name_alpha VARCHAR(255) default '0',
c_leader_location VARCHAR(255) default '0',
c_leader_name VARCHAR(255) default '0',
c_leader_phone VARCHAR(255) default '0',
c_leader_title VARCHAR(255) default '0',
c_leader_title_status VARCHAR(255) default '0',
c_page VARCHAR(255) default '0',
c_report_admin_asst_name VARCHAR(255) default '0',
c_report_director_name VARCHAR(255) default '0',
c_report_timekeeper_name VARCHAR(255) default '0',
c_timekeeper_email VARCHAR(255) default '0',
c_timekeeper_name VARCHAR(255) default '0',
c_timekeeper_phone VARCHAR(255) default '0',
c_timekeeper_status VARCHAR(255) default '0',
department_name VARCHAR(255) default '0',
dept_alpha VARCHAR(255) default '0',
dept_id VARCHAR(255) default '0',
first_name VARCHAR(255) default '0',
fk_admin_asst_id VARCHAR(255) default '0',
fk_director_id VARCHAR(255) default '0',
fk_timekeeper_id VARCHAR(255) default '0',
last_name VARCHAR(255) default '0',
pk_depts_id VARCHAR(255) default '0',
source VARCHAR(255) default '0',
suppress_from_web VARCHAR(255) default '0',
cur_timestamp TIMESTAMP (8)
);
load DATA INfile 'c:/Data/Documents/sd_depts.txt'
IGNORE INTO TABLE departments
FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '' ESCAPED BY '$' LINES TERMINATED BY '\r';