By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,812 Members | 1,978 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,812 IT Pros & Developers. It's quick & easy.

export-import problem

P: n/a
I export data from a table that contains a varchar field that stores whole
names in it. Some of the names include the apostrophe character....
O'Neal, etc... When I attempt to import the data (using the copy command
the apostrophe kills the import. If I export the data with quotes around
the varchar field the quotes get stored inside the varchar field.
What the magic incantation to get apostrophes in textual data without
surrounding the data with quotes?
--
--
GreyGeek
Nov 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Thu, 2004-10-28 at 19:39 -0500, GreyGeek wrote:
I export data from a table that contains a varchar field that stores whole
names in it. Some of the names include the apostrophe character....
O'Neal, etc... When I attempt to import the data (using the copy command
the apostrophe kills the import. If I export the data with quotes around
the varchar field the quotes get stored inside the varchar field.
What the magic incantation to get apostrophes in textual data without
surrounding the data with quotes?


Quotes have no special effect in COPY input:

junk=# create table jj (id INTEGER, jname text);
CREATE TABLE
junk=# copy jj from stdin;
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
1 O'Neil
2 O'Grady
\.

junk=#

What precisely are you doing?

--
Oliver Elphick ol**@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA
========================================
"But they that wait upon the LORD shall renew their
strength; they shall mount up with wings as eagles;
they shall run, and not be weary; and they shall walk,
and not faint." Isaiah 40:31
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #2

P: n/a
On Thu, 2004-10-28 at 19:39 -0500, GreyGeek wrote:
I export data from a table that contains a varchar field that stores whole
names in it. Some of the names include the apostrophe character....
O'Neal, etc... When I attempt to import the data (using the copy command
the apostrophe kills the import. If I export the data with quotes around
the varchar field the quotes get stored inside the varchar field.
What the magic incantation to get apostrophes in textual data without
surrounding the data with quotes?


Quotes have no special effect in COPY input:

junk=# create table jj (id INTEGER, jname text);
CREATE TABLE
junk=# copy jj from stdin;
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
1 O'Neil
2 O'Grady
\.

junk=#

What precisely are you doing?

--
Oliver Elphick ol**@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA
========================================
"But they that wait upon the LORD shall renew their
strength; they shall mount up with wings as eagles;
they shall run, and not be weary; and they shall walk,
and not faint." Isaiah 40:31
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.