0

I have the following command where i am trying to copy a csv into a postgre table.

copy "SIS_student"(
            student_id, user_id, peims_id, district_id, prior_identifier, 
            first_name, middle_name, last_name, sex_code, race, date_of_birth, 
            birth_place, country_entry_date, address1, address2, address3, 
            city, state, zip, phone, email, status, campus_id_id, homeroom, 
            eco_dis_code, title1_pa_code, average_daily_attendance, ca_tech_ed_code, 
            bilingual_code, lep_code, esl_code, special_ed_code, gifted_tal_code, 
            at_risk_code, migrant_code, certification_date, graduation_date, 
            quartile, graduation_plan, class_rank, class_size, ranking_date, 
            gpa, nga, weighed_gpa, weighed_nga, peims_campus, next_yr_loc, 
            sumr_loc, c504, avid, last_update_date, last_updated_by, ethnicity_code, grade, 
            homeless, sept1_age, parental_permission, yrs_us_schools_text, 
            achievement_test_date, read_nce1, lang_nce1, eng_prof_test_date, 
            eng_prof_score, eng_prof_score_lvl, sp_prof_test_date, sp_prof_score, 
            sp_prof_score_lvl, peims_language, immigrant, date_entered_us_school, 
            grade_entered, years_in_us_schools, original_placement_date, 
            last_exit_date, parent_perm_date, ethnicity_race_code)
from '/home/abhishek/Downloads/HP/Student.csv' with delimiter ';' and NULL as 'NULL';

But i am getting a syntax error at AND. Where am i going wrong? The purpose i am doing this is because my DateTime fields are not taking NULL values from the csv even when i enabled NULL values

1 Answer 1

1

There is no and. It is just a comma

with (delimiter ';', NULL 'NULL');

http://www.postgresql.org/docs/current/static/sql-copy.html

Sign up to request clarification or add additional context in comments.

3 Comments

still throwing me this error: syntax error at or near ","
@crozzfire Edited. There are parenthesis around the options.
@crozzfire And there is no as

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.