pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Copy Command Error
2+ messages / 2 participants
[nested] [flat]

* Copy Command Error
@ 2003-09-15 08:57 Richard Sydney-Smith <richard@ibisaustralia.com>
  2003-09-15 10:01 ` Re: Copy Command Error Richard Huxton <dev@archonet.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Richard Sydney-Smith @ 2003-09-15 08:57 UTC (permalink / raw)
  To: pgsql-sql

I am outputting the following rows from a SYBASE database on W2000

3 '2' 'IBISFinancials' 'A.C.N. 072 378 815'
8 'RK' 'Personal Accounts' 

Using the command: 

select cast(seq as integer) , id , cmpy, tr_n from fcont; output to d:\fcont.dat format 'ascii' delimited by '\x09'

This outputs the fields tab delimited and with strings encased in inverted commas

I then use the followin POSTRESQL command:

copy fcont (seq,id,cmpy,tr_n) from 'd:\\fcont.dat'

The problem is that each string is imported with the inverted commas.

eg field ID = ''RK'' instead of 'RK'

Can someone please help?

thanks

Richard

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Copy Command Error
  2003-09-15 08:57 Copy Command Error Richard Sydney-Smith <richard@ibisaustralia.com>
@ 2003-09-15 10:01 ` Richard Huxton <dev@archonet.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Richard Huxton @ 2003-09-15 10:01 UTC (permalink / raw)
  To: Richard Sydney-Smith <richard@ibisaustralia.com>; pgsql-sql

On Monday 15 September 2003 09:57, Richard Sydney-Smith wrote:
> I am outputting the following rows from a SYBASE database on W2000

> The problem is that each string is imported with the inverted commas.
>
> eg field ID = ''RK'' instead of 'RK'
>
> Can someone please help?

A short bit of perl. Something like (untested)

perl -pi -e 's/\t"/\t/g' fcont.dat
perl -pi -e 's/"\t/\t/g' fcont.dat

That should pre-process the file. I'm sure someone else on the list will show 
how to do it in sed.

Hmm - just noticed you are on Windows. Not sure what cygwin ships with, or 
whether you have perl installed.
-- 
  Richard Huxton
  Archonet Ltd



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-09-15 10:01 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-09-15 08:57 Copy Command Error Richard Sydney-Smith <richard@ibisaustralia.com>
2003-09-15 10:01 ` Richard Huxton <dev@archonet.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox