
[dbo].[DereferenceSessionSnapshot]
CREATE PROCEDURE [dbo].[DereferenceSessionSnapshot]
@SessionID as varchar(32),
@OwnerID as uniqueidentifier
AS
UPDATE SN
SET TransientRefcount = TransientRefcount - 1
FROM
SnapshotData AS SN
INNER JOIN [ReportServerTempDB].dbo.SessionData AS SE ON SN.SnapshotDataID = SE.SnapshotDataID
WHERE
SE.SessionID = @SessionID AND
SE.OwnerID = @OwnerID
UPDATE SN
SET TransientRefcount = TransientRefcount - 1
FROM
[ReportServerTempDB].dbo.SnapshotData AS SN
INNER JOIN [ReportServerTempDB].dbo.SessionData AS SE ON SN.SnapshotDataID = SE.SnapshotDataID
WHERE
SE.SessionID = @SessionID AND
SE.OwnerID = @OwnerID
GO
GRANT EXECUTE ON [dbo].[DereferenceSessionSnapshot] TO [RSExecRole]
GO