Stored Procedures [dbo].[DeleteSnapshotAndChunks]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@SnapshotIDuniqueidentifier16
@IsPermanentSnapshotbit1
Permissions
TypeActionOwning Principal
GrantExecuteRSExecRole
SQL Script
CREATE PROCEDURE [dbo].[DeleteSnapshotAndChunks]
@SnapshotID uniqueidentifier,
@IsPermanentSnapshot bit
AS
IF @IsPermanentSnapshot != 0 BEGIN
    DELETE ChunkData
    WHERE ChunkData.SnapshotDataID = @SnapshotID
       
    DELETE SnapshotData
    WHERE SnapshotData.SnapshotDataID = @SnapshotID
   
END ELSE BEGIN
    DELETE [ReportServerTempDB].dbo.ChunkData
    WHERE SnapshotDataID = @SnapshotID
       
    DELETE [ReportServerTempDB].dbo.SnapshotData
    WHERE SnapshotDataID = @SnapshotID
END   
      

GO
GRANT EXECUTE ON  [dbo].[DeleteSnapshotAndChunks] TO [RSExecRole]
GO
Uses