Re: Importing directly from BCP files
От | David Rowley |
---|---|
Тема | Re: Importing directly from BCP files |
Дата | |
Msg-id | CAKJS1f_7eVMOFKva+wwQSjqVoAmHaMa0kP4gyz1tW_pVYtTfNw@mail.gmail.com обсуждение исходный текст |
Ответ на | Importing directly from BCP files (Tim Uckun <timuckun@gmail.com>) |
Ответы |
Re: Importing directly from BCP files
|
Список | pgsql-general |
On 16 November 2015 at 15:31, Tim Uckun <timuckun@gmail.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
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/
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
В списке pgsql-general по дате отправления: