From: | David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> |
---|---|
To: | Tim Uckun <timuckun(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Importing directly from BCP files |
Date: | 2015-11-16 03:09:04 |
Message-ID: | CAKJS1f_7eVMOFKva+wwQSjqVoAmHaMa0kP4gyz1tW_pVYtTfNw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 16 November 2015 at 15:31, Tim Uckun <timuckun(at)gmail(dot)com> wrote:
> Does anybody have any documentation on what a BCP file from SQL server
> looks like?
>
That appears to depend on the -f option
https://msdn.microsoft.com/en-nz/library/ms162802.aspx
There's more details on the format files here
https://msdn.microsoft.com/en-nz/library/ms191516.aspx
Have you tried opening a file in a text editor to see what they look like?
> I have a directory full of BCP files and I would like to import them into
> PG.
>
>
The default format seems to be separating values with a tab character.
The bulk import command in PostgreSQL is COPY, so you'll likely want to
look at http://www.postgresql.org/docs/9.4/static/sql-copy.html
Let's assume you have *.bcp files in the default format with values
separated with tabs, you could open up psql and use a command something
along the lines of:
copy <table name> from '<filename>' delimiter ' '; -- <- use a tab
character between the quotes.
Of course, you'll need to create the table first with CREATE TABLE.
> Has anybody done anything like this before?
>
>
I'd imagine that it's fairly common.
--
David Rowley http://www.2ndQuadrant.com/
<http://www.2ndquadrant.com/>
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | S McGraw | 2015-11-16 04:25:47 | Re: Importing directly from BCP files |
Previous Message | Tim Uckun | 2015-11-16 02:31:57 | Importing directly from BCP files |