I have a function in my SQL Server 2008 thats return a resulset and some output variables.
From PHP, i need get the values with sqlsrv library.
I have this code, which I tested with a stored procedure and work fine.
<?php
$serverName = "(local)\MSSQLSERVER, 1433";
$connectionInfo = array(
"Database"=>"xxxx",
"UID"=>"xxxx",
"PWD"=>"xxxx"
);
$conn = sqlsrv_connect($serverName, $connectionInfo);
if(!$conn) {
die();
}
$tsql_callSP = "{call my_function(?, ?)}";
$ret_cod = "";
$ret_desc = "";
$params = array(
array($ret_cod, SQLSRV_PARAM_OUT),
array($ret_desc, SQLSRV_PARAM_OUT)
);
$stmt = sqlsrv_query( $conn, $tsql_callSP, $params);
if( $stmt === false )
{
debug("Error in executing statement");
die( debug( sqlsrv_errors(), true));
}
The result of error is:
[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Error en la solicitud procedimiento 'my_function'. 'my_function' es un objeto función con valores de tabla
Is a sintaxis error i know, but i dont find examples on internet of how to do this.
I try,
$tsql_callSP = "? = {call my_function(?, ?)}";
And similar but dont works.
Any ideas?.
Thanks you.