Import CSV table in PostgreSQL -


i want import in postgresql csv table next structure:

1,qw,sdf,ty 2,efw,sd,hj,gh,hj 3,sfd,sd,gf,gh,h 4,fg,sd,dff 

i use sql query:

create table test("nom" integer, "f1" text, "f2" text, "f3" text, "f4" text, "f5" text);  copy bptable("nom", "f1", "f2", "f3", "f4", "f5") 'd:\data.csv' delimiter ',' csv; 

but receive exception: error: data after last expected column sql state: 22p04, row 2. hope can help. advance thanks.

i've never imported data using csv before, have 4 'columns' in csv file (line 1 , 4) , 5 columns in sql table.

edit: need specifiy column missing data so:

1,bla1,bla2,,bla3 

note double coma between bla2 , bla3


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -