use DBI; my $dbh = DBI->connect("dbi:ODBC:db_test","Admin","password-here", {RaiseError => 1, PrintError => 1, AutoCommit => 1} ); my $sel = $dbh->prepare("SELECT [Name] FROM MSysObjects WHERE [Type] = 1 and [Name] not like 'MSys%'"); $sel->execute; my @tables; while (my ($tab) = $sel->fetchrow_array) { push(@tables, $tab) } $sel->finish; for (@tables) { my $sel = $dbh->prepare("SELECT * FROM $_;"); $sel->execute(); open(DBF,">$_"); print DBF join("\t", @{$sel->{NAME}}), "\n"; while(my (@r) = $sel->fetchrow_array) { for (0..$#r) { $r[$_] =~ s/[\n\r\t]/\?/sg } print DBF join("\t", @r), "\n"; } close(DBF); $sel->finish; }