in reply to DBI Question

I am trying to find out if a SQL wildcard ('%') can be used in a DBI script next to a placeholder. Something like this: $sth = $dbh->prepare( "SELECT name FROM people WHERE name LIKE ?%" ); I do this on a regular basis without needing to escape the '%' character, but in Sybase (and I assume MS SQL Server) , a string with a wildcard needs to be quoted:

$sth = $dbh->prepare( "SELECT name FROM people WHERE name LIKE 'Jones%'" );

-----
"Computeri non cogitant, ergo non sunt"

Replies are listed 'Best First'.
Re: Re: DBI Question
by dsb (Chaplain) on Jan 18, 2001 at 19:45 UTC
    Yes. Now how do i do it with a place holder and scalar variable.
    $sth = $dbh->prepare( "SELECT name FROM people WHERE name like ?" ); $sth->execute( $name );
    how do include a wildcard in the where the placeholder is without appending it to the variable.