ODBC Driver for SQL Server

Build 21.0.7958

Executing Stored Procedures

The following code example shows how to execute stored procedures and retrieve their results.

Procedure for Calling Stored Procedures

The odbc_exec function called be used to call a stored procedure with the EXECUTE syntax, as described in EXECUTE Statements. As with Querying Data, the results can be obtained by iterating on the returned resource.

$stmt = odbc_exec($cnx, "EXECUTE SearchSuppliers Country = 'US'");
while ($row = odbc_fetch_array($stmt)) {
    echo "result = ", $row["result"], "\n";
}

Copyright (c) 2021 CData Software, Inc. - All rights reserved.
Build 21.0.7958