SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [Lending].[uspHMDAUpdateExport] (@BatchId int, @ModifiedById int)
AS
BEGIN
SET NOCOUNT ON
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
DISABLE TRIGGER Lending.utrHMDAAudit ON Lending.HMDA
UPDATE Lending.HMDA SET IsExported = 1,ModifiedById = @ModifiedById WHERE BatchId = @BatchId
ENABLE TRIGGER Lending.utrHMDAAudit ON Lending.HMDA
END
SET QUOTED_IDENTIFIER OFF
GO
GRANT EXECUTE ON [Lending].[uspHMDALarInfoGet] TO [caApplication] AS [dbo]
GO
Says the DISABLE and ENABLE syntax is wrong. Why?
You need some semicolons (at the end of the statement preceding
DISABLEand at the end of the statement beforeENABLE)On a side note setting the isolation to
READ UNCOMMITTEDand disabling triggers both seem distinctly dubious to me.In this case the isolation level doesn’t seem like it would make any difference to the following statements so is this standard practice in all your procedures? If so are you aware of the potential issues with it?
Regarding the trigger disabling what is to stop another concurrent transaction modifying the table whilst the trigger is disabled?