1

Topic: select from procedure with dynamic request

Situation following:
There is a function func1 returning varchar with generated SELECT (kol-in columns dynamic).
There is a procedure proc1 as a result of which operation the table with result of performance of request from func1 is deduced.
(The table with dynamic kol-vom columns) it is necessary to transfer result of performance of procedure in a php-code which at present understands only pure select with any in advance unknown kol-vom columns, instead of function or procedure in which result this is fulfilled or generated select.
Whether there is a method select th to receive result of operation of procedure proc1?
select * from openquery (DB, ' exec proc1 ') swears on dynamism of request.
Thankful in advance)
. There were thoughts to make view, but there a similar problem with dynamism of request

2

Re: select from procedure with dynamic request

If you and so form request dynamic, what hinders to generate correct with result sets ?
Though, I would solve a question here with it:

UncleFedor32 wrote:

a php-code which at present understands only pure select with any in advance unknown kol-vom columns, instead of function or procedure

3

Re: select from procedure with dynamic request

UncleFedor32 wrote:

the Situation following:
There is a function func1 returning varchar with generated SELECT (kol-in columns dynamic).
There is a procedure proc1 as a result of which operation the table with result of performance of request from func1 is deduced.
(The table with dynamic kol-vom columns) it is necessary to transfer result of performance of procedure in a php-code which at present understands only pure select with any in advance unknown kol-vom columns, instead of function or procedure in which result this is fulfilled or generated select.
Whether there is a method select th to receive result of operation of procedure proc1?
select * from openquery (DB, ' exec proc1 ') swears on dynamism of request.
Thankful in advance)
. There were thoughts to make view, but there a similar problem with dynamism of request

What for delirium?
PHP remarkably executes exec AnyProc.
Be not able - invite the pioneer.

4

Re: select from procedure with dynamic request

Prompt, please, as it is possible to process an output through php. I can not find a method Yet

5

Re: select from procedure with dynamic request

var $res = 0;
$query = ' {? = CALL [dbo]. [procedure] (????)} ';
$params = array (
array ($res, SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_INT);
array (' A ', SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING (' UTF-8 '));
array (' B ', SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING (' UTF-8 '));
array (' A C ', SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING (' UTF-8 '));
array (4, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_INT)
);
$stmt = sqlsrv_query ($handle, $query, $params/*, array (' QueryTimeout ' => 30) */);
if (false! == $stmt) {
$results = array ();
if (sqlsrv_has_rows ($stmt)) {
do {
$thisresult = array ();
while (false! == ($row = sqlsrv_fetch_array ($stmt, SQLSRV_FETCH_ASSOC))) {
foreach ($row as $k => $v) {
if (is_resource ($v)) {
$row [$k] = stream_get_contents ($v);
}
}
$thisresult [] = $row;
}
$results [] = $thisresult;
} while (false! = ($resultset = sqlsrv_next_result ($stmt)));
}
sqlsrv_free_stmt ($stmt);
}