| This page is user contributed documentation. See the bottom of the page for information about the author. | |
How to move a database from a popular proprietary database to the world's most powerful open source database.
CREATE TABLE [dbo].[Select] ([Union] [int])
set file [open "C:\\inetpub\\ftproot\\tablelist.txt" r]
while {![eof $file]} {
set table [gets $file]
exec bcp ..$table out $table -c -k -S192.168.100.1 -Usa -Ppassword -r ~
}
close $file
ftp> lcd /home/homer/workdir
Local directory now /home/homer/workdir
ftp> fget tablelist.txt
#!/usr/pkg/bin/tclsh
set file [open tblnames 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 {\000} $data {} data
regsub -all {\n} $data \\\n data
regsub -all {~} $data \n data
set file [open $f w]
puts -nonewline $file $data
close $file
}
COPY tablename FROM '/home/homer/workdir/tablename' with null as '';
$ psql newdb < modifiedscript.sql &> outfile
$ cat outfile | grep ERROR