You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?php$connection = new \PDO("odbc:DRIVER={ODBC Driver 17 for SQL Server};host=<host>", "<username>", "<password>");
$query = "select itm_code from item where itm_number = :itemNumber";
$parameters = [":itemNumber" => "123456"]; // itm_number column defined as varchar(5) parameter is char(6)$prepared = $connection->prepare($query);
$results = $prepared->execute($parameters);
?>
Resulted in this output:
SQLSTATE[HY010]: Function sequence error: [unixODBC][Driver Manager]Function sequence error (SQLExecute[0] at /build/php8.1-8.1.9/ext/pdo_odbc/odbc_stmt.c:254)
The error only happens when the bound parameter is larger than the column as defined. Does not happen when using literals within the query string. I would expect to just receive 0 results not an error.