Can we run a stored procedure in Azure SQL Database asynchronously.

Ayush Shrivastava 0 Reputation points
2024-07-15T12:20:11.3033333+00:00

I want to run my stored procedure async using T-SQL. Can we do it ?

Azure SQL Database
{count} votes

2 answers

Sort by: Most helpful
  1. Sedat SALMAN 13,345 Reputation points
    2024-07-15T12:26:38.35+00:00

    Azure Automation allows you to create runbooks that can execute PowerShell scripts or other scripts to run your stored procedures asynchronously

    https://learn.microsoft.com/en-us/answers/questions/1165217/how-schedule-a-sql-query-to-run-every-day-on-azure

    or

    You can use Azure Functions to create a serverless solution that executes your stored procedure based on a timer schedule

    https://learn.microsoft.com/en-us/answers/questions/1165217/how-schedule-a-sql-query-to-run-every-day-on-azure

    and another method is to use service broker


  2. Oury Ba-MSFT 17,791 Reputation points Microsoft Employee
    2024-07-15T16:42:21.7433333+00:00

    @Ayush Shrivastava Thank you for reaching out.

    In addition to Sedat SALMAN's answer, you could also use ADF and schedule the execution of the procedure. You can create a pipeline with one or more Stored Procedure activities and add a trigger to schedule the pipeline running. see this https://stackoverflow.com/questions/62417858/run-azure-sql-server-stored-procedure-async

    https://learn.microsoft.com/en-us/azure/azure-sql/database/job-automation-overview?view=azuresql

    Regarding the second question,

    By default, job agents are created at JA100, allowing up to 100 elastic job executions concurrently. Initiating a service level change is an asynchronous operation and the new service level will be made available after a short provisioning delay.

    If you need more than 100 concurrent executions of elastic job agents, higher service levels are available, see Concurrent capacity tiers. You can currently change the service level of a job agent via the Azure portal, PowerShell, or REST API.

    Exceeding the service level with concurrent jobs will create queuing delays before jobs start in excess of the service level's concurrent jobs limit.

    0 comments No comments