Thread Ascii-file in mysql einpflegen ? (4 answers)
Opened by Gast at 2007-04-25 12:14

pktm
 2007-04-25 14:27
#35409 #35409
User since
2003-08-07
2921 Artikel
BenutzerIn
[Homepage]
user image
Ungetestet und unvollständig und unschön:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
    use FileHandle;
use DBI;
my $dbh = connect2db();
my $file = "blubb.txt";
my $fh = new FileHandle;
if ($fh->open("< $file")) {

while( $fh->getline() ) {
my ($feld1, $feld13) = split/\#/, $_);
my $sql = qq~
INSERT INTO Tabelle ..... $feld1, $feld13
~;
# statement wie in DBI.pm beschrieben ausführen
}

$fh->close();
}else{
# fehlermeldung...
}
http://www.intergastro-service.de (mein erstes CMS :) )

View full thread Ascii-file in mysql einpflegen ?