use DBI ':sql_types'; my $dbh = DBI->connect(...); my $sth = $dbh->prepare("SELECT * FROM $table WHERE $field = ?"); $sth->bind_param(1, undef, SQL_VARCHAR); # or SQL_CHAR? untested. # For numeric types, experiment with SQL_NUMERIC or SQL_INTEGER ... # Now go ahead, DBI will treat any data for the (first) field as a string...