Re: Problems importing csv files

From: Robert Schnabel <schnabelr(at)missouri(dot)edu>
To: Kindra Martinenko <kindramart(at)yahoo(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Problems importing csv files
Date: 2009-06-22 20:15:57
Message-ID: 4A3FE67D.2080401@missouri.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
Kindra Martinenko wrote:
<blockquote cite="mid:249550(dot)32069(dot)qm(at)web30207(dot)mail(dot)mud(dot)yahoo(dot)com"
type="cite">
<style type="text/css"><!-- DIV {margin:0px;} --></style>
<div
style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div>Hello,</div>
<div><br>
</div>
<div>I am having problems importing csv files into postgresql. I am
hoping someone has had a similar problem and could help me troubleshoot.</div>
<div><br>
</div>
<div>
<div>I created a table that mimics the csv table I want to read from.
&nbsp;I set privleges to "All" and have been attempting to execute the
following procedure:</div>
<div><br>
</div>
<div>
<div>
<div><font class="Apple-style-span"
face="'Courier New', courier, monaco, monospace, sans-serif">COPY
BaxterCommercial WITH OIDS FROM 'H:\...\BaxterCommercial.csv'</font></div>
<div><font class="Apple-style-span"
face="'Courier New', courier, monaco, monospace, sans-serif">USING
DELIMITERS ',';</font></div>
<div><font class="Apple-style-span" face="'Courier New'"><br>
</font></div>
</div>
</div>
</div>
</div>
</blockquote>
You need to escape the \ and maybe use the absolute path.<br>
<a class="moz-txt-link-freetext" href="http://www.postgresql.org/docs/8.3/interactive/sql-copy.html">http://www.postgresql.org/docs/8.3/interactive/sql-copy.html</a><br>
<br>
If you're using Windows try this but put the full path name instead of
...&nbsp; I use this frequently to load large files.<br>
<div><font class="Apple-style-span"
face="'Courier New', courier, monaco, monospace, sans-serif">COPY
BaxterCommercial WITH OIDS FROM E'H:\\...\\BaxterCommercial.csv'</font></div>
<div><font class="Apple-style-span"
face="'Courier New', courier, monaco, monospace, sans-serif">WITH CSV;</font></div>
<br>
Bob<br>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 2.0 KB

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Kindra Martinenko 2009-06-22 23:15:40 Re: Problems importing csv files
Previous Message Tom Lane 2009-06-22 20:10:05 Re: Problems importing csv files