The query in the PHP code below works fine when I run it via Microsoft SQL Server Management Studio, but gives
Warning: odbc_fetch_into() [function.odbc-fetch-into]: No tuples available at this result index
at the odbc_fetch_into
call (and does not have any rows).
$sql = "DECLARE @ValueList TABLE (CheckValue int)
INSERT INTO @ValueList VALUES (1)
INSERT INTO @ValueList VALUES (2)
INSERT INTO @ValueList VALUES (3)
SELECT VL.CheckValue
FROM @ValueList AS VL";
$rs = odbc_exec($conn, $sql);
$badValues = array();
while (odbc_fetch_into($rs, $missRow) !== false) {
$badValues[] = $missRow[0];
}
Other queries against the database that don't use table variables work fine in this context. And calling odbc_errormsg
afterwards doesn't return an error.
PHP Version 5.2.6, SQL Server 2005