gregfthompson
asked on
Syntax error in PostgreSQL
Query problem in postgreSQL
There are 33 tables and there is a query that is meant to set the delimiter as '|'
COPY address_alias_type_aut
C:\GNAF\Authority Code\Authority_Code_ADDRES S_ALIAS_TY PE_AUT_psv .csv' DELIMITER '|' CSV HEADER;
But it will not run:
ERROR: syntax error at or near "C"
LINE 3: C:\GNAF\Authority Code\Authority_Code_ADDRES S_ALIAS_TY PE_AUT...
^
SQL state: 42601
Character: 30
I've doublechecked the folders and file names in C: drive and they appear to be correct (files uploaded here)
The full tables setup query and the full delimiter query are attached.
Help will be much appreciated.
create-tables.txt set-delimiter.txt Authority-Code.rar
There are 33 tables and there is a query that is meant to set the delimiter as '|'
COPY address_alias_type_aut
C:\GNAF\Authority Code\Authority_Code_ADDRES
But it will not run:
ERROR: syntax error at or near "C"
LINE 3: C:\GNAF\Authority Code\Authority_Code_ADDRES
^
SQL state: 42601
Character: 30
I've doublechecked the folders and file names in C: drive and they appear to be correct (files uploaded here)
The full tables setup query and the full delimiter query are attached.
Help will be much appreciated.
create-tables.txt set-delimiter.txt Authority-Code.rar
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for keeping looking.
I amended the script to this:
COPY address_alias_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_ADDRE SS_ALIAS_T YPE_AUT_ps v.csv' DELIMITER '|' CSV HEADER;
COPY address_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_ADDRE SS_TYPE_AU T_psv.csv' DELIMITER '|' CSV HEADER;
COPY flat_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_FLAT_ TYPE_AUT_p sv.csv' DELIMITER '|' CSV HEADER;
COPY geocode_reliability_aut from C:\\GNAF\\Authority Code\\Authority_Code_GEOCO DE_RELIABI LITY_AUT_p sv.csv' DELIMITER '|' CSV HEADER;
COPY geocode_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_GEOCO DE_TYPE_AU T_psv.csv' DELIMITER '|' CSV HEADER;
COPY geocoded_level_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_GEOCO DED_LEVEL_ TYPE_AUT_p sv.csv' DELIMITER '|' CSV HEADER;
COPY level_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_LEVEL _TYPE_AUT_ psv.csv' DELIMITER '|' CSV HEADER;
COPY locality_alias_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_LOCAL ITY_ALIAS_ TYPE_AUT_p sv.csv' DELIMITER '|' CSV HEADER;
COPY locality_class_aut from C:\\GNAF\\Authority Code\\Authority_Code_LOCAL ITY_CLASS_ AUT_psv.cs v' DELIMITER '|' CSV HEADER;
COPY mb_match_code_aut from C:\\GNAF\\Authority Code\\Authority_Code_MB_MA TCH_CODE_A UT_psv.csv ' DELIMITER '|' CSV HEADER;
COPY ps_join_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_PS_JO IN_TYPE_AU T_psv.csv' DELIMITER '|' CSV HEADER;
COPY street_class_aut from C:\\GNAF\\Authority Code\\Authority_Code_STREE T_CLASS_AU T_psv.csv' DELIMITER '|' CSV HEADER;
COPY street_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_STREE T_TYPE_AUT _psv.csv' DELIMITER '|' CSV HEADER;
COPY street_locality_alias_type _aut from C:\\GNAF\\Authority Code\\Authority_Code_STREE T_LOCALITY _ALIAS_TYP E_AUT_psv. csv' DELIMITER '|' CSV HEADER;
COPY street_suffix_aut from C:\\GNAF\\Authority Code\\Authority_Code_STREE T_SUFFIX_A UT_psv.csv ' DELIMITER '|' CSV HEADER;
But still the same result:
ERROR: syntax error at or near "C"
LINE 1: COPY address_alias_type_aut from C:\\GNAF\\Authority Code\\A...
^
SQL state: 42601
Character: 34
I amended the script to this:
COPY address_alias_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_ADDRE
COPY address_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_ADDRE
COPY flat_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_FLAT_
COPY geocode_reliability_aut from C:\\GNAF\\Authority Code\\Authority_Code_GEOCO
COPY geocode_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_GEOCO
COPY geocoded_level_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_GEOCO
COPY level_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_LEVEL
COPY locality_alias_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_LOCAL
COPY locality_class_aut from C:\\GNAF\\Authority Code\\Authority_Code_LOCAL
COPY mb_match_code_aut from C:\\GNAF\\Authority Code\\Authority_Code_MB_MA
COPY ps_join_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_PS_JO
COPY street_class_aut from C:\\GNAF\\Authority Code\\Authority_Code_STREE
COPY street_type_aut from C:\\GNAF\\Authority Code\\Authority_Code_STREE
COPY street_locality_alias_type
COPY street_suffix_aut from C:\\GNAF\\Authority Code\\Authority_Code_STREE
But still the same result:
ERROR: syntax error at or near "C"
LINE 1: COPY address_alias_type_aut from C:\\GNAF\\Authority Code\\A...
^
SQL state: 42601
Character: 34
ASKER
There's something wrong with the syntax for the folder name and the slashes or backslashes. But I am unable to find a solution.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your help. Without your help I would not have solved this problem anywhere near as quickly.
ASKER
I've tried c:// and C:\\ but neither works.