Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy problem - reserved word!

Status
Not open for further replies.
Jan 26, 2004
18
US
Ok, so my DBA labeled a column "ORDER" which is a SQL reserved work. Not smart. Unfortunately I cant take the time to drop the column, re-add at it with a new name and dump the data back in. This sucks. I am trying to save the MIS folks some heartache by using copy to dump a bunch of data into the backend and COPY poops out when it finds the ORDER column. Check it out.

varius=# COPY tracker.schedule_items (SCHEDULE_ID,ORDER,NAME,BASELINE_DURATION,BASELINE_LAG_TYPE_ID,BASELINE_LAG_DURATION,BASELINE_COST_LABOR,BASELINE_COST_MATERIALS,BASELINE_COST_EXPENSES,STATUS_ID,PROGRESS) from '/home/brown_c/BARKSDALE_NEW.csv' WITH DELIMITER ',';
ERROR: parser: parse error at or near "ORDER" at character 42

Ok, so I quote that ORDER column...lets try that out.
varius=# COPY tracker.schedule_items (SCHEDULE_ID,"ORDER",NAME,BASELINE_DURATION,BASELINE_LAG_TYPE_ID,BASELINE_LAG_DURATION,BASELINE_COST_LABOR,BASELINE_COST_MATERIALS,BASELINE_COST_EXPENSES,STATUS_ID,PROGRESS) from '/home/brown_c/BARKSDALE_NEW.csv' WITH DELIMITER ',';
ERROR: Relation "schedule_items" has no column "ORDER"

Oh my, I can assure you that the table does have an ORDER column. what to do, what to do?
If anybody has any smart ideas on how I might overcome this hurdle, I would gladly buy you a beer and slice of pizza. Meanwhile, I am going to go berate my DBA for being a peeesa-krap.
 
DERP!!! the answer came to me. I made the table name lower case and blammo, the thing worked.

Spank my ass and call me charlie. Thanks anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top