I execute this query with php and odbc driver
$sql="DECLARE @Auftrag int;
DECLARE @date_now datetime = getdate();
EXEC @Auftrag=EHS.dbo.SP_ANZEIGE
@Tablet=1,
@Status=0,
@KuNr='K015538';
SELECT 'generatedID'=@Auftrag;";
$res = odbc_exec($db1_link, $sql) or die(odbc_errormsg()); // returns resource(13)
$firstRow = odbc_fetch_array($res); // dies error
If i do odbc_fetch_array the error "No tuples available at this result index" is thrown.
If I run the exact same query in Management Studio everything works fine. It shows me the computed generatedID. What is the difference?
greets Alex
set nocount on. That prevents SQL Server from sending rowcount updates, which UNIX clients sometimes mistake for actual rowsets.