Обсуждение: Export Access 97 to PostgreSQL

Поиск
Список
Период
Сортировка

Export Access 97 to PostgreSQL

От
"Shavonne Marietta Wijesinghe"
Дата:
Hello
 
I have a db in MS Access 97 and now i have to import the data in PostgreSQL. I can create the table structure in PostgreSql but in what format can i export the table from Access so Postgresql can read it?
 
Thanks
 
Shavonne

Re: Export Access 97 to PostgreSQL

От
Shane Ambler
Дата:
Shavonne Marietta Wijesinghe wrote:
> Hello
> 
> I have a db in MS Access 97 and now i have to import the data in
> PostgreSQL. I can create the table structure in PostgreSql but in
> what format can i export the table from Access so Postgresql can read
> it?

csv would be the most common and easiest.

Basically any structured text file can be used as you have the option of 
specifying what characters are used to separate fields etc when you 
import to postgresql.



-- 

Shane Ambler
pgSQL (at) Sheeky (dot) Biz

Get Sheeky @ http://Sheeky.Biz


Re: Export Access 97 to PostgreSQL

От
Shawn
Дата:
On Wednesday 26 March 2008 11:46:43 Shavonne Marietta Wijesinghe wrote:
> Hello
>
> I have a db in MS Access 97 and now i have to import the data in
> PostgreSQL. I can create the table structure in PostgreSql but in what
> format can i export the table from Access so Postgresql can read it?
>
> Thanks
>
> Shavonne

Hello Shavonne,

I'm no expert but I have often used either the tab or comma delimited format.  
It requires that the fields in the PostgreSQL table are in the same order as 
the original and that the data types are formatted similarly, but it has 
worked for me.  Also a sed and awk'ing of the results can clean up alot of 
formatting issues.

example, one of my fields is in the timestamp with time zone format but MS-SQL 
doesn't differentiate Time Zones, at least not in the database I'm pulling 
from.  I use this line to add the UTC to the field " sed 's/\t/ UTC\t/1'".

Shawn 



Re: Export Access 97 to PostgreSQL

От
"Shavonne Marietta Wijesinghe"
Дата:
Thanks. I tried the following command

COPY REGIONI FROM 
'C:/Inetpub/wwwroot2/FORMWebSite1/database/FormAjax/REGIONI.copy' WITH 
DELIMITER '\t';

But i get this error

ERROR:  relation "regioni" does not exist

Here is a sample of my file (fields seperated with a tab)

13600770000,00 848351,00 2,00 2,00 4,00 "Trentino-alto adige"
18424000000,00 1132202,00 3,00 3,00 5,00 "Veneto"
7859928000,00 746082,90 4,00 4,00 6,00 "Friuli-venezia giulia"

What can the problem be?

Shavonne 



Re: Export Access 97 to PostgreSQL

От
Ivan Sergio Borgonovo
Дата:
On Thu, 27 Mar 2008 10:03:57 +0100
"Shavonne Marietta Wijesinghe" <shavonne.marietta@studioform.it>
wrote:

> Thanks. I tried the following command
> 
> COPY REGIONI FROM 
> 'C:/Inetpub/wwwroot2/FORMWebSite1/database/FormAjax/REGIONI.copy'
> WITH DELIMITER '\t';
> 
> But i get this error
> 
> ERROR:  relation "regioni" does not exist

You've to create the REGIONI table.
You may (or may not) get into trouble with locale. I noticed you're
using , as a decimal separator.
So if you're still encountering problems... that could be the second
thing to look at.

> Here is a sample of my file (fields seperated with a tab)

> 13600770000,00 848351,00 2,00 2,00 4,00 "Trentino-alto adige"
> 18424000000,00 1132202,00 3,00 3,00 5,00 "Veneto"
> 7859928000,00 746082,90 4,00 4,00 6,00 "Friuli-venezia giulia"

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it



Re: Export Access 97 to PostgreSQL

От
"Shavonne Marietta Wijesinghe"
Дата:
Strange coz i created the table. Why doesn't it seem to find it??

CREATE TABLE "REGIONI"
( "AREA" int4, "PERIMETER" int4, "REGIONI_" int4, "REGIONI_ID" int4, "COD_REG" int4, "REGIONE" text
) 
WITHOUT OIDS;


Re: Export Access 97 to PostgreSQL

От
"Marcin Stępnicki"
Дата:
On Thu, Mar 27, 2008 at 11:06 AM, Shavonne Marietta Wijesinghe
<shavonne.marietta@studioform.it> wrote:

> COPY REGIONI FROM
(...)
> Strange coz i created the table. Why doesn't it seem to find it??
>
>  CREATE TABLE "REGIONI"

You need to quote the name in your COPY command as well.


Re: Export Access 97 to PostgreSQL

От
"Shavonne Marietta Wijesinghe"
Дата:
Thanks.. So it was a uppercase problem ;)

Shavonne.


Re: Export Access 97 to PostgreSQL

От
Roberto Spier
Дата:
Shavonne Marietta Wijesinghe escreveu:
> Hello
>  
> I have a db in MS Access 97 and now i have to import the data in 
> PostgreSQL. I can create the table structure in PostgreSql but in what 
> format can i export the table from Access so Postgresql can read it?
>  
> Thanks
>  
> Shavonne
Export the data, instead! You'd connect (link) to the postgreSQL 
database from within access mdb, then run an acc's INSERT INTO  query.

hth

--  Spier