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"
SNEH PANDYA
  • 799
  • 7
  • 22

1 Answers1

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!

Jaykumar Patel
  • 25,525
  • 12
  • 68
  • 75