C2026-007 Upgrade - Generate Missing Word Attachments/B2026-027 Update Refresh Tables For Search Tooltip
This commit is contained in:
@@ -24736,6 +24736,46 @@ GO
|
||||
==========================================================================================================
|
||||
*/
|
||||
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[GetMissingDocsByUnit]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [GetMissingDocsByUnit];
|
||||
|
||||
GO
|
||||
|
||||
-- =============================================
|
||||
-- Author: Matthew Schill
|
||||
-- Create date: 02/27/2026
|
||||
-- Description: Get Missing Docs by Unit for Generating Pdf table
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[GetMissingDocsByUnit]
|
||||
AS
|
||||
BEGIN
|
||||
|
||||
select Docs.DocID, UnitID, SectionID = MIN(SectionID)
|
||||
FROM
|
||||
(SELECT DISTINCT [DocID]
|
||||
FROM [VEPROMS_Barakah].[dbo].[tblDocuments]) Docs
|
||||
INNER JOIN Entries on Docs.DocID = Entries.DocID
|
||||
INNER JOIN Contents on Entries.ContentID = Contents.ContentID
|
||||
inner join Items on Items.ContentID = Contents.ContentID
|
||||
outer apply
|
||||
(Select UnitID = ID FROM dbo.vefn_SplitInt([dbo].[ve_GetItemDerivedApplicability](Items.ItemID),',')) Unit
|
||||
outer apply
|
||||
(Select TOP 1 SectionID = ItemID FROM Contents SecC where SecC.ContentID = Contents.ContentID
|
||||
AND (SecC.Type / 10000) = 1
|
||||
AND dbo.vefn_GetVersionIDByItemID(ItemID) IS NOT NULL
|
||||
) Section
|
||||
left outer join Pdfs on Pdfs.DocID = Docs.DocID AND Pdfs.DebugStatus = CASE WHEN UNITID IS NULL THEN 0 ELSE UnitID * 10 END
|
||||
WHERE Pdfs.DocID IS NULL
|
||||
AND SectionID IS NOT NULL
|
||||
Group by Docs.DocID, UnitID
|
||||
order by Docs.DocID, UnitID
|
||||
|
||||
RETURN
|
||||
END
|
||||
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: [GetMissingDocsByUnit] Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: [GetMissingDocsByUnit] Error on Creation'
|
||||
GO
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
@@ -24770,8 +24810,8 @@ BEGIN TRY -- Try Block
|
||||
DECLARE @RevDate varchar(255)
|
||||
DECLARE @RevDescription varchar(255)
|
||||
|
||||
set @RevDate = '03/12/2026 11:00 AM'
|
||||
set @RevDescription = 'Update to Purge Change History Tool'
|
||||
set @RevDate = '03/13/2026 7:00 AM'
|
||||
set @RevDescription = 'Added Get Missing Docs by Unit for Generating Pdf table'
|
||||
|
||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||
|
||||
Reference in New Issue
Block a user