use Data::Dumper; use DBI; my $dbh = DBI-> connect('DBI:ODBC:MyDB'); # Catch and display status messages with this error handler. sub err_handler { my ($sqlstate, $msg, $nativeerr) = @_; # Strip out all of the driver ID stuff $msg =~ s/^(\[[\w\s:]*\])+//; print $msg; print "===> state: $sqlstate msg: $msg nativeerr: $nativeerr\n"; return 0; } $dbh->{odbc_err_handler} = \&err_handler; $dbh->{odbc_exec_direct} = 1; my $sql = qq/SELECT * FROM Files WHERE (((Files.Field) Like '*20060906 +*'));/; # the query to execute my $sth = $dbh->prepare($sql); # prepare the query $sth->execute(); # execute the query while ( @row = $sth->fetchrow_array ) { print "@row\n"; }
In reply to DBI to ODBC by matthewsnape
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |