C2021-059 - Update Proms Fixes
This commit is contained in:
parent
0f67382c27
commit
c81f527cb8
@ -23519,6 +23519,90 @@ GO
|
||||
==========================================================================================================
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
==========================================================================================================
|
||||
Start: C2021-059: SQL to delete folders using admin tool
|
||||
==========================================================================================================
|
||||
*/
|
||||
|
||||
IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'deleteFolderAdmin')
|
||||
DROP PROCEDURE [dbo].[deleteFolderAdmin]
|
||||
GO
|
||||
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
CREATE PROCEDURE [dbo].[deleteFolderAdmin]
|
||||
|
||||
(
|
||||
@FolderID int
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN TRY -- Try Block
|
||||
BEGIN TRANSACTION
|
||||
DELETE From Assignments WHERE [FolderID]=@FolderID
|
||||
DELETE From Associations where VersionID in (select versionid from DocVersions where folderid = @FolderID)
|
||||
DELETE From DocVersions where VersionID in (select versionid from DocVersions where folderid= @FolderID)
|
||||
DELETE From DocVersions where [FolderID]=@FolderID
|
||||
|
||||
-- Delete from items where ItemID matches
|
||||
DELETE FROM tblitems
|
||||
WHERE ItemID IN (
|
||||
SELECT DISTINCT ItemID
|
||||
FROM docversions
|
||||
WHERE folderID = @folderID
|
||||
);
|
||||
|
||||
|
||||
-- Delete from items where ItemID matches
|
||||
DELETE FROM tblitems
|
||||
WHERE ItemID IN (
|
||||
SELECT DISTINCT ItemID
|
||||
FROM docversions
|
||||
WHERE folderID = @folderID
|
||||
);
|
||||
|
||||
-- Delete from tblContents where ContentID matches
|
||||
DELETE FROM tblContents
|
||||
WHERE ContentID IN (
|
||||
SELECT DISTINCT c.ContentID
|
||||
FROM tblContents c
|
||||
JOIN items i ON c.ContentID = i.ItemID
|
||||
WHERE i.ItemID IN (
|
||||
SELECT DISTINCT ItemID
|
||||
FROM docversions
|
||||
WHERE folderID = @folderID
|
||||
)
|
||||
);
|
||||
|
||||
DELETE From Folders WHERE [ParentID] = @FolderID
|
||||
DELETE From Folders WHERE [FolderID] = @FolderID
|
||||
|
||||
|
||||
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||
END TRY
|
||||
BEGIN CATCH -- Catch Block
|
||||
IF( @@TRANCOUNT = 1 ) ROLLBACK -- Only rollback if top level
|
||||
ELSE IF( @@TRANCOUNT > 1 ) COMMIT -- Otherwise commit. Top level will rollback
|
||||
EXEC vlnErrorHandler
|
||||
END CATCH
|
||||
|
||||
GO
|
||||
/*
|
||||
==========================================================================================================
|
||||
End: C2021-059: SQL to delete folders using admin tool
|
||||
==========================================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
| ADD New Code Before this Block |
|
||||
@ -23552,8 +23636,8 @@ BEGIN TRY -- Try Block
|
||||
DECLARE @RevDate varchar(255)
|
||||
DECLARE @RevDescription varchar(255)
|
||||
|
||||
set @RevDate = '07/18/2024 11:24'
|
||||
set @RevDescription = 'C2024-005 Add an Admin tool that can delete a group of annotations.'
|
||||
set @RevDate = '07/29/2024 11:24'
|
||||
set @RevDescription = 'C2021-059 Add SQL for Admin tool delete folders.'
|
||||
|
||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||
|
Loading…
x
Reference in New Issue
Block a user