Please let me know the issue for this Blocking issue in UAT server?
I got the error frequently after kill the sessions.
Please help me in the above .
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[proc_SecUpdateRoleDef](
@SiteId uniqueidentifier,
@WebId uniqueidentifier,
@RoleId int,
@Title nvarchar(255),
@Description nvarchar(512),
@Order int,
@Type tinyint,
@PermMask tPermMask,
@RequestGuid uniqueidentifier = NULL OUTPUT)
ASSET NOCOUNT ON
DECLARE @RET int SET @RET = 0 BEGIN TRAN
IF EXISTS(
SELECT TOP 1
1
FROM
My_Roles_UpdLock_SiteWeb(@SiteId, @WebId) AS R
WHERE
R.Title = @Title AND
R.RoleId <> @RoleId)
BEGIN
SET @RET = 80
GOTO cleanup
END
UPDATE
R
SET
R.Title = @Title,
R.Description = @Description,
R.RoleOrder = @Order,
R.Type = @Type,
R.PermMask = COALESCE(@PermMask, R.PermMask)
FROM
TVF_Roles_PK(@SiteId, @WebId, @RoleId) AS R
IF 0 <> @@ERROR
BEGIN
SET @RET = 80
GOTO cleanup
END
IF @PermMask IS NOT NULL
BEGIN
EXEC proc_SecUpdateAcl @SiteId, @WebId
EXEC proc_SecUpdateSiteLevelSecurityMetadata @SiteId, 1, 0
END
DECLARE @ScopeId uniqueidentifier
SELECT TOP 1
@ScopeId = W.ScopeId
FROM
TVF_Webs_Id(@WebId) AS W
WHERE
W.SiteId = @SiteId
EXEC proc_SecLogChange @SiteId, @WebId, @ScopeId, NULL, @RoleId, NULL, 16777216, NULL
cleanup:
IF (@RET <> 0 AND @@TRANCOUNT = 1) ROLLBACK TRAN ELSE COMMIT TRAN
IF @RET <> 0
RETURN @RET
EXEC proc_GetWebIdAuditMask @SiteId, @WebId
RETURN @RET
GO
I am using functions in this stored proc.
One of the func code(My_Roles_UpdLock_SiteWeb) is given below contains Tran logic.
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[TVF_Roles_UpdLock_SiteWeb]
(
@SiteId uniqueidentifier,
@WebId uniqueidentifier
)
RETURNS TABLE AS RETURN
SELECT
*
FROM
Roles WITH (UPDLOCK, INDEX=Roles_PK)
WHERE
SiteId = @SiteId AND
WebId = @WebId
GO.
Please help me if there any blocking in the above code.