I think that's indeed a good solution...
Here are some ideas to help you.
First use bcp to extract info from MSSQLSERVER
bcp table1 out c:\_tmp\table1.txt -c -k -S. -U sa -P
The -k is important to be able to get back NULL values....
Then copy this file on Linux and apply the following tcl script :
tablelist.txt contains your path to table1.txt file and more files for
multi-table migration....
tclconvert.txt
******************************************************
set file [open tablelist.txt r]
set flist [read -nonewline $file]
close $file
set flist [split $flist \n]
foreach f $flist {
set file [open $f r]
set data [read -nonewline $file]
close $file
regsub -all "\t\t" $data "\t_NULL_\t" data
regsub -all "\t\n" $data "\t_NULL_\n" data
regsub -all {\\} $data {\\\\} data
set file [open $f w]
puts $file $data
puts $file
close $file
}
*******************************************************
run the command
tclsh tclconvert.txt
Then import the resulting file in postgresql using COPY command
COPY table1 FROM 'table1.txt' with null as '_NULL_';"
If you are interested in, I will send you my complete migration script...
You will have to adapt them but they will give you an idea of how to do it.
-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Hegyvari
Krisztian
Sent: Thursday, November 21, 2002 2:19 PM
To: fs@snes.edu
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] MS-server <-> Ppostgresql
Just an idea: we recently migrated a bigger database from BTrieve to Oracle,
through intermediate text files. Can't you do something similar? Exporting
on one side and importing on the other. That worked better for us than
copying on a record by record basis.
Regards,
Hegyvari Krisztian
>>> Francois Sauterey <fs@snes.edu> 11/21/02 01:35pm >>>
Apology for my so poop english... and my cross-postage.
I plan to extract/copy about 120.000 lines from a MS SQL 7 server database
(on a NT machione) to a postresql database on a Linux machine
(debian/woody).
But what a pity : I obtain (after so many tests, so many compilation with
so many different options) a copy of about 1200 lines/minute ;~{
And horror, I plan to make the same thing whith a 3.000.000 lines database.
Any idea ?
Best regards
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)