diff --git a/PROMS/DataLoader/PROMSFixes.Sql b/PROMS/DataLoader/PROMSFixes.Sql index 6f0981bf..0240b1ed 100644 --- a/PROMS/DataLoader/PROMSFixes.Sql +++ b/PROMS/DataLoader/PROMSFixes.Sql @@ -10273,7 +10273,7 @@ GO /***************************************************************************** Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE - Copyright 2013 - Volian Enterprises, Inc. All rights reserved. + Copyright 2017 - Volian Enterprises, Inc. All rights reserved. *****************************************************************************/ CREATE FUNCTION [dbo].[vefn_GetDisconnectedItems]() @@ -10296,6 +10296,8 @@ BEGIN where ItemID not in(select ItemID from @UsedItems)) ii Join Contents CC ON CC.ContentID = II.ContentID And CC.Type is not null + UNION + Select ItemId, ContentID from vefn_GetZeroFromType() RETURN END GO @@ -11295,13 +11297,14 @@ GO /***************************************************************************** Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE - Copyright 2016 - Volian Enterprises, Inc. All rights reserved. + Copyright 2017 - Volian Enterprises, Inc. All rights reserved. *****************************************************************************/ CREATE PROCEDURE [dbo].[vesp_PurgeDisconnectedData] WITH EXECUTE AS OWNER AS BEGIN TRY -- Try Block BEGIN TRANSACTION + delete from tblParts where FromType=0 declare @UsedItems Table ( itemid int primary key, contentID int ) insert into @UsedItems @@ -13354,6 +13357,57 @@ IF (@@Error = 0) PRINT 'Procedure Creation: getUsers Succeeded' ELSE PRINT 'Procedure Creation: getUsers Error on Creation' GO +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetZeroFromType]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1) + DROP FUNCTION [vefn_GetZeroFromType]; +GO +/****** Object: UserDefinedFunction [dbo].[vefn_GetZeroFromType] ******/ +SET ANSI_NULLS ON +GO +SET QUOTED_IDENTIFIER ON +GO +/* +Select * from vefn_GetZeroFromType() +*/ +/***************************************************************************** + Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE + Copyright 2017 - Volian Enterprises, Inc. All rights reserved. +*****************************************************************************/ +CREATE FUNCTION [dbo].[vefn_GetZeroFromType]() +RETURNS @DiscItems TABLE +( + ItemID int primary Key, + ContentID int, + UNIQUE (ContentID) +) +WITH EXECUTE AS OWNER +AS +BEGIN +with ItemZ (BaseID, ItemID, ContentID) as +(Select PP.ContentID BaseID, II.ItemID, II.ContentID from Items II +Join Parts PP ON PP.ItemID = II.ItemID +where FromType = 0 +Union All + -- Children + select z.BaseID, I.[ItemID], I.[ContentID] + from Itemz Z + join Parts P on P.ContentID = Z.ContentID + join Items I on I.ItemID = P.ItemID + Union All + -- Siblings + select z.BaseID, I.[ItemID], I.[ContentID] + from Itemz Z + join Items I on I.PreviousID = Z.ItemID + ) + --select *, dbo.ve_GetShortPath(ItemID) Location from ItemZ + insert into @DiscItems + Select ItemID, ContentID from ItemZ + RETURN +END + +go +IF (@@Error = 0) PRINT 'TableFunction [vefn_GetZeroFromType] Succeeded' +ELSE PRINT 'TableFunction [vefn_GetZeroFromType] Error on Creation' + ----------------------------------------------------------------------------- /* @@ -13380,8 +13434,8 @@ BEGIN TRY -- Try Block set nocount on DECLARE @RevDate varchar(255) DECLARE @RevDescription varchar(255) - set @RevDate = '7/20/2017 11:00 AM' - set @RevDescription = 'Sort users list' + set @RevDate = '7/25/2017 9:35 AM' + set @RevDescription = 'Added vefn_GetZeroFromType and modified Disconnected Data' Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription IF( @@TRANCOUNT > 0 ) COMMIT