azureazure-sql-databaseazure-synapsesql-azure-federationssql-azure-alerts

Azure SQL alerts on a T sql query


We have a table where we create a record for a job and remove them once the job is complete. I would like to check if there is any records still hanging more than a an hour or so. We do maintain audit timestamps in the table. Is there in an option in anyway I can create an alert on Azure SQL based on a TSQL query or something which we help achieve the above?


Solution

  • You can use a Condition Control of an Azure Logic App to check whether a given result set is valid. If the condition satisfies then you can send the email.

    enter image description here

    You can execute a stored procedure action to check records hanging more than a an hour. On below images stored procedure returns resultsets, you can use the logic for checking records still hanging more than a an hour and in the next condition you can check the result set brings records (is true) or not (is false). If it's true you can send email else not.

    enter image description here

    enter image description here