0

Finding the failed queries in Azure SQL Description: How can I get all the failed queries in Azure SQL for the last 5 days? Use-case- I need to troubleshoot certain issues

Vikash
  • 1

1 Answers1

0

You need to use Extended Events to capture all T-SQL instructions failing. Use the sqlserver.error_reported event as shown below:

CREATE EVENT SESSION azure_monitor
ON DATABASE

ADD EVENT sqlserver.error_reported(
ACTION (sqlserver.client_app_name, sqlserver.client_hostname, sqlserver.session_id, sqlserver.sql_text,
        sqlserver.username))
Alberto Morillo
  • 256
  • 1
  • 4