my $sqlStatement = "SELECT * FROM databaseName ORDER BY ID"; # Making the database connection my $dbh = new Win32::ODBC("User") or die "Couldn't connect to database: " . DBI->errorstr; if ($dbh->Sql($sqlStatement)){ print "SQL failed!.\n"; print "Error: " . $dbh->Error() . "\n"; $dbh->Close(); exit; } my @dates = (); my %Data = (); # Loop through the recordset, put the data into our array, then do with it as we please while( $dbh->FetchRow() ) { %Data = $dbh->DataHash(); push( @dates, $Data{myDateTime} ); } # Say goodbye to the database $dbh->Close();