how to view SQL executed by sqlsrv_query

Asked

Viewed 50 times

0

I run the following code:

$sql = "UPDATE [dbo].[NOTA_FISCAL] 
        SET [STATUS] = ?,
            [USUARIO]= ?,
            DATA_TRATAMENTO = (getdate()),
            [MOTIVO_CANCELAMENTO] = ?
        WHERE [ID_NOTA_FISCAL] = ?";
$params = [2,30,'',7];      
$options= ["Scrollable" => "forward", 'QueryTimeout' => 60];
sqlsrv_query($this->MSconn, $sql, $params, $options);

I would like to see the SQL that runs in the database by sqlsrv_query , 'cause even though in my head it’s all right he’s not running in the database.

You can enable it to generate the log of the queries performed or something?

currently agreed to bug disconnecting and reconnecting the database, however seeing the SQL run in the database would be interesting.

  • 1

    Enough to appear some error? can use function sqlsrv_errors()

  • no, it does not present any error. soon after I have an if (($errors = sqlsrv_errors() ) != null) that does not enter.

  • 1

    I turned the problem off by disconnecting and connecting again, but I really wanted a way to visualize which SQL it is running

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.