Created a GetAllFormats Stored Procedure for Update Formats

Use new Stored Procedure to get all formats including those designation unused
This commit is contained in:
Rich
2018-05-18 16:05:53 +00:00
parent 588edabb25
commit 11086a17a1
2 changed files with 100 additions and 5 deletions

View File

@@ -13849,6 +13849,41 @@ IF (@@Error = 0) PRINT 'Procedure Creation: getFormats Succeeded'
ELSE PRINT 'Procedure Creation: getFormats Error on Creation'
GO
/****** Object: StoredProcedure [getAllFormats] ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getAllFormats]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [getAllFormats];
GO
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2018 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
CREATE PROCEDURE [dbo].[getAllFormats]
WITH EXECUTE AS OWNER
AS
SELECT * From (SELECT
[FormatID],
[ParentID],
[Name],
[Description],
[Data],
[GenMac],
[DTS],
[UserID],
[LastChanged],
(SELECT COUNT(*) FROM [Contents] WHERE [Contents].[FormatID]=[Formats].[FormatID]) [ContentCount],
(SELECT COUNT(*) FROM [DocVersions] WHERE [DocVersions].[FormatID]=[Formats].[FormatID]) [DocVersionCount],
(SELECT COUNT(*) FROM [Folders] WHERE [Folders].[FormatID]=[Formats].[FormatID]) [FolderCount],
(SELECT COUNT(*) FROM [Formats] [Children] WHERE [Children].[ParentID]=[Formats].[FormatID]) [ChildCount]
FROM [Formats] ) T1
RETURN
GO
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'Procedure Creation: getAllFormats Succeeded'
ELSE PRINT 'Procedure Creation: getAllFormats Error on Creation'
GO
-----------------------------------------------------------------------------
/*
---------------------------------------------------------------------------
@@ -13874,8 +13909,8 @@ BEGIN TRY -- Try Block
set nocount on
DECLARE @RevDate varchar(255)
DECLARE @RevDescription varchar(255)
set @RevDate = '5/10/2018 2:15 PM'
set @RevDescription = 'Exclude formats that contain (Unused) in their description'
set @RevDate = '5/18/2018 11:00 AM'
set @RevDescription = 'Include Unused formats in Format Update'
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
IF( @@TRANCOUNT > 0 ) COMMIT