Azure / azure-functions-sql-extension

Azure SQL bindings for Azure Functions ⚡️ supports Azure SQL Database, Azure SQL Managed Instance, and SQL Server 2016+
https://aka.ms/sqlbindings
MIT License
120 stars 61 forks source link

Failed to renew leases due to exception: Exception message: Incorrect syntax near ';'. #1108

Closed MaddyDev closed 2 months ago

MaddyDev commented 2 months ago

The SQL trigger generates invalid T-SQL intermittently while renewing leases, causing false alerts in the monitoring system. The issue does not affect the functionality of the SQL Trigger. SQL trigger raising Microsoft.Data.SqlClient.SqlException. Exception message: Incorrect syntax near \';\'

Below are the logs from the system:

Exception executing query. Message=Incorrect syntax near ';'. Query= DECLARE @result int; EXEC @result = sp_getapplock @Resource = '_az_func_Trigger', @LockMode = 'Exclusive', @LockTimeout = 30000 IF @result < 0 BEGIN RAISERROR('Unable to acquire exclusive lock on _az_func_Trigger. Result = %d', 16, 1, @result) END;

UPDATE [az_func].[Leases_cacf2bceb5090ff5_1845581613] SET _az_func_LeaseExpirationTime = DATEADD(second, 60, SYSDATETIME()) WHERE ;

Refer Icm for more information.