0

I have tried reffering to the questions asked in SO

in my sql i have written :

COPY lcities FROM E'C:\\Users\\ADMIN\\Desktop\\sneh.csv' DELIMITER ';' CSV

ERROR:  invalid input syntax for integer: "Lawyer Code, Lawyer Name, Years of Experience, Location, Average Rating"
CONTEXT:  COPY lcities, line 1, column id: "Lawyer Code, Lawyer Name, Years of Experience, Location, Average Rating"

********** Error **********

ERROR: invalid input syntax for integer: "Lawyer Code, Lawyer Name, Years of Experience, Location, Average Rating"
SQL state: 22P02
Context: COPY lcities, line 1, column id: "Lawyer Code, Lawyer Name, Years of Experience, Location, Average Rating"
3
  • What's unclear about "relation "sneh" does not exist"?
    – user330315
    Apr 6, 2014 at 13:18
  • Surely that's pretty self explanatory. There is no table named sneh. (Are you perhaps being confused by case folding? Is there a table named "SNEH" - note the double quotes ?) Apr 6, 2014 at 13:19
  • Duplicate: stackoverflow.com/a/14083542/1216680
    – Houari
    Apr 6, 2014 at 13:36

1 Answer 1

1

ok this ERROR: relation "sneh" does not exist tell you to your PostgreSQL table sneh does not exist.

You first create sneh name table inside PostgreSQL and try again. But be clear when you create table at that time take care for which datatype you can use. Because this would be create error, the reason behind conflict datatype from CSV data or your PostgreSQL Column Data type.


And your Path i think not navigate to your destination location Update this 2 time backward Slash to a Forward Slash.

C:/Users/ADMIN/Desktop/sneh.csv

Update Permission via Command Prompt

chmod a+rX  C:/Users/ADMIN/Desktop/sneh.csv

This will change access rights for your folder. Now everyone will be able to read your file.

Update Permission via My Computer

  • Right click the Desktop folder containing the data file(s) that permission was denied to and then click Properties.
  • Select the Security tab.
  • Click the Edit button.
  • In the "Permissions for the folder" window that opened, click the Add button.
  • Type Everyone into the "Enter the object names to select" text area box.
  • Click OK and the window will close.
  • Verify that the default Read & Execute permissions were set to Allow via the check checkbox in the previous window.
  • Click OK and the window will close.
  • Click the Apply button in the Folder Properties window.

Hope this help you!

5
  • i have changed it to my table in postgresql , now it shows mw that unable to read Apr 6, 2014 at 13:25
  • COPY lcities FROM E'chomod a+rX C:/Users/ADMIN/Desktop/sneh.csv' DELIMITER ';' CSV am i correnct ? Apr 6, 2014 at 13:29
  • no you first give permission to that folder via Command Prompt or My Computer. Apr 6, 2014 at 13:33
  • 2
    you can ask another question on here. Do not modify this question. And if this answer help you then accept. Apr 6, 2014 at 13:41
  • Windows doesn't have chmod. Also as far as I know Windows doesn't use the "execute" bit on directories as "may traverse the dir" like 'nix does, though I'm unsure of that bit. Apr 7, 2014 at 2:37

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.