LOck Timout Azure SQL

jatin pathak 111 Reputation points
2021-03-02T14:57:23.583+00:00

I am running is job in Azure Runbook for the SQL Database and it is failing with error "Lock request time out period exceeded." . Wondering how can i control/change this value in Azure . Can I change this in Azure SQL connection string ? what is the default value ?

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. Alberto Morillo 33,176 Reputation points MVP
    2021-03-02T15:23:20.82+00:00

    Call a stored procedure from Azure Automation that perform all you want.

    Try using

    SET LOCK_TIMEOUT -1 inside the stored procedure.
    

    Before each transaction and statements.

    When running the stored procedure from Azure Azutomation set the timeout to zero.

    $DatabaseCommand = New-Object System.Data.SqlClient.SqlCommand
    $DatabaseCommand.CommandType = [System.Data.CommandType]::StoredProcedure
    $DatabaseCommand.Connection = $DatabaseConnection
    # A value of 0 indicates no limit
    $DatabaseCommand.CommandTimeout = 0
    $DatabaseCommand.CommandText = $SP
    
    0 comments No comments