I have an PHP script that execute a store procedure. So far so good. Now I have a store procedure that execute two queries within the store procedure:
EXEC ('Delete From [DB].dbo.[Table]')
EXEC ('INSERT INTO [DB].dbo.[Table] ([Col])VALUES(1)')
If I call the SP with php, it only delete the content of the Table and doesn't Insert the first row. (It seemed to be that only the first Exec will be executed) I call the SP in PHP as followed:
$stmt = sqlsrv_query($connection, "EXEC my_sp" );
...
while( $row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC) ) {
...
}
The return isn't that important for me at the moment. I'm only wondering why only the first query is executed. If call the SP directly at the database the query will be executed like expected. There is no error-message or something like that. Does anybody know how I can execute both "execs" an a SP with only one php call?
Thank's for help! V