D:\...>afs_filter.pl DBD::CSV::st execute failed: Execution ERROR: Cannot open afs: No such file or directory at C:/Perl64/lib/DBD/File.pm line 565 . [for Statement "select * from AFS where ID_DEVTYP like 'INTELI%' AND ID_POINT like 'AUTO%'"] at D:\...\afs_filter.pl line 53. DBD::CSV::st fetchrow_hashref failed: Attempt to fetch row without a preceeding execute () call or from a non-SELECT sta tement [for Statement "select * from AFS where ID_DEVTYP like 'INTELI%' AND ID_POINT like 'AUTO%'"] at D:\...\afs_filter.pl line 60. #### This is perl, v5.10.1 built for MSWin32-x64-multi-thread (with 2 registered patches, see perl -V for more detail) Copyright 1987-2009, Larry Wall Binary build 1007 [291969] provided by ActiveState http://www.ActiveState.com Built Jan 27 2010 14:12:21 #### use warnings; use strict; use DBI; # Create connection string to database point.csv (output file from scadaexport.pl) my $dbh = DBI->connect ("dbi:CSV:csv_auto_diag=1", { f_dir => ".", f_ext => ".csv/r", f_enc => "utf-8", file => "point.csv", }); # Associate our csv file with the table name "AFS" and include custom column names $dbh->{csv_tables}->{AFS} = { file => "point.csv", col_names => [qw( RECORD SUBSCRIPT ID_SUBSTN CO_SUBSTN AREA_SUBSTN ID_DEVTYP ID_DEVICE NAME_DEVICE AREA_DEVICE ID_MEAS ID_POINT SITE_POINT AREA_POINT )], }; # Define and Execute SQL to select INTELI and AUTO points my $sth = $dbh->prepare ("select * from AFS where ID_DEVTYP like 'INTELI%' AND ID_POINT like 'AUTO%'"); $sth->execute; #### RECORD,SUBSCRIPT,ID_SUBSTN,CO_SUBSTN,AREA_SUBSTN,ID_DEVTYP,ID_DEVICE,NAME_DEVICE,AREA_DEVICE,ID_MEAS,ID_POINT,SITE_POINT,AREA_POINT a,b,c,d,e,f,g,h,i,j,k,l,m . .