SQLSRV and multiple selects in Stored Procedure

前端 未结 2 1830
予麋鹿
予麋鹿 2021-01-13 13:39

I have a Stored Procedured which creates a temporary table (#test), fills it with data from another table, runs 3 selects on this temporal table and drops it.

The or

2条回答
  •  遥遥无期
    2021-01-13 14:33

    I was actually just having a similar issue and managed to get the following to work:

    $result = array();
    
    // Get return value
    do {
       while ($row = sqlsrv_fetch_array($query)) {
           // Loop through each result set and add to result array
           $result[] = $row;
       }
    } while (sqlsrv_next_result($query));
    
    print_r($result);
    

    The do-while loop will advance through all results (rather than having to do this manually). It seems that looping through sqlsrv_fetch_array() is essential so I think this is the real answer.

提交回复
热议问题