From: | Vibhor Kumar <vibhor(dot)kumar(at)enterprisedb(dot)com> |
---|---|
To: | ray <ray(at)aarden(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to Create Table from CSV |
Date: | 2011-03-06 18:59:06 |
Message-ID: | C74E3956-4336-4AEF-A151-E733D30C7582@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mar 7, 2011, at 12:13 AM, ray wrote:
>
> CREATE TABLE Equpment_List_Sheet2 FROM 'Equipment List, reference
> r1_Sheet2.csv' WITH DELIMITER ',' NULL '' CSV HEADER;
> ERROR: syntax error at or near "FROM"
> LINE 1: CREATE TABLE Equpment_List_Sheet2 FROM 'Equipment List,
> refe...
>
> ^
> ********** Error **********
> ERROR: syntax error at or near "FROM"
> SQL state: 42601
> Character: 35
> ____________
> copy TABLE Equpment_List_Sheet2 FROM 'Equipment List, reference
> r1_Sheet2.csv' WITH DELIMITER ',' NULL '' CSV HEADER;
> ERROR: syntax error at or near "TABLE"
> LINE 1: copy TABLE Equpment_List_Sheet2 FROM 'Equipment List,
> refere...
> ^
> ********** Error **********
> ERROR: syntax error at or near "TABLE"
> SQL state: 42601
> Character: 6
You can't create a table using CSV. However try following:
1. Create structure of table (Parse the column using some script or manually)
2. Import data using COPY Command.
Thanks & Regards,
Vibhor Kumar
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
vibhor(dot)kumar(at)enterprisedb(dot)com
Blog:http://vibhork.blogspot.com
From | Date | Subject | |
---|---|---|---|
Next Message | Rich Shepard | 2011-03-06 19:20:09 | Re: How to Create Table from CSV |
Previous Message | ray | 2011-03-06 18:43:22 | How to Create Table from CSV |