B2022-104: SearchReferenced Objects in PROMS is not finding any results
This commit is contained in:
parent
d35222e6bc
commit
a858733052
@ -20996,15 +20996,15 @@ BEGIN TRY -- Try Block
|
|||||||
|
|
||||||
|
|
||||||
SELECT [ContentID],[Number],[Text],[Type],[FormatID],[Config],[DTS],[UserID],[LastChanged],
|
SELECT [ContentID],[Number],[Text],[Type],[FormatID],[Config],[DTS],[UserID],[LastChanged],
|
||||||
(SELECT COUNT(*) FROM [Details] WHERE [Details].[ContentID]=[Contents].[ContentID]) [DetailCount],
|
(SELECT COUNT(1) FROM [Details] WHERE [Details].[ContentID]=[Contents].[ContentID]) [DetailCount],
|
||||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[ContentID]=[Contents].[ContentID]) [EntryCount],
|
(SELECT COUNT(1) FROM [Entries] WHERE [Entries].[ContentID]=[Contents].[ContentID]) [EntryCount],
|
||||||
(SELECT COUNT(*) FROM [Grids] WHERE [Grids].[ContentID]=[Contents].[ContentID]) [GridCount],
|
(SELECT COUNT(1) FROM [Grids] WHERE [Grids].[ContentID]=[Contents].[ContentID]) [GridCount],
|
||||||
(SELECT COUNT(*) FROM [Images] WHERE [Images].[ContentID]=[Contents].[ContentID]) [ImageCount],
|
(SELECT COUNT(1) FROM [Images] WHERE [Images].[ContentID]=[Contents].[ContentID]) [ImageCount],
|
||||||
(SELECT COUNT(*) FROM [Items] WHERE [Items].[ContentID]=[Contents].[ContentID]) [ItemCount],
|
(SELECT COUNT(1) FROM [Items] WHERE [Items].[ContentID]=[Contents].[ContentID]) [ItemCount],
|
||||||
(SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ContentID]=[Contents].[ContentID]) [PartCount],
|
(SELECT COUNT(1) FROM [Parts] WHERE [Parts].[ContentID]=[Contents].[ContentID]) [PartCount],
|
||||||
(SELECT COUNT(*) FROM [RoUsages] WHERE [RoUsages].[ContentID]=[Contents].[ContentID]) [RoUsageCount],
|
(SELECT COUNT(1) FROM [RoUsages] WHERE [RoUsages].[ContentID]=[Contents].[ContentID]) [RoUsageCount],
|
||||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[FromID]=[Contents].[ContentID]) [TransitionCount],
|
(SELECT COUNT(1) FROM [Transitions] WHERE [Transitions].[FromID]=[Contents].[ContentID]) [TransitionCount],
|
||||||
(SELECT COUNT(*) FROM [ZContents] WHERE [ZContents].[ContentID]=[Contents].[ContentID]) [ZContentCount]
|
(SELECT COUNT(1) FROM [ZContents] WHERE [ZContents].[ContentID]=[Contents].[ContentID]) [ZContentCount]
|
||||||
FROM [Contents] where ContentID in (Select ID From @Enh1)
|
FROM [Contents] where ContentID in (Select ID From @Enh1)
|
||||||
|
|
||||||
IF( @@TRANCOUNT > 0 ) COMMIT
|
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||||
@ -21252,8 +21252,174 @@ GO
|
|||||||
==========================================================================================================
|
==========================================================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
==========================================================================================================
|
||||||
|
Start: B2022-104: SearchReferenced Objects in PROMS is not finding any results
|
||||||
|
==========================================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
If Exists (Select * From sys.Indexes Where Name = N'IX_tblROUsagesRODbIDDeleteStatusContentID')
|
||||||
|
Drop Index [IX_tblROUsagesRODbIDDeleteStatusContentID] on [dbo].[tblROUsages]
|
||||||
|
Go
|
||||||
|
|
||||||
|
CREATE NONCLUSTERED INDEX [IX_tblROUsagesRODbIDDeleteStatusContentID]
|
||||||
|
ON [dbo].[tblROUsages] ([RODbID],[DeleteStatus])
|
||||||
|
INCLUDE ([ContentID],[ROID])
|
||||||
|
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
IF (@@Error = 0) PRINT 'Index Creation: [IX_tblROUsagesRODbIDDeleteStatusContentID] Succeeded'
|
||||||
|
ELSE PRINT 'Index Creation: [IX_tblROUsagesRODbIDDeleteStatusContentID] Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If Exists(SELECT * FROM sys.objects Where name = 'vefn_RofstDataFormatRoidKey' AND type in (N'FN'))
|
||||||
|
DROP FUNCTION [dbo].[vefn_RofstDataFormatRoidKey]
|
||||||
|
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.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
-- ==========================================================================================
|
||||||
|
-- Author: Jake Ropar
|
||||||
|
-- Create Date: 08/19/2022
|
||||||
|
-- Description: Cleans/Formats the specified roid key, with its return value ext if applicable
|
||||||
|
-- ==========================================================================================
|
||||||
|
|
||||||
|
Create Function [dbo].[vefn_RofstDataFormatRoidKey](@Roid VarChar(25), @Check16Digits bit = 0) Returns VarChar(Max)
|
||||||
|
With Execute As Owner
|
||||||
|
Begin
|
||||||
|
|
||||||
|
Declare @RoidKey VarChar(Max) = '';
|
||||||
|
|
||||||
|
-- Trim Start/End and Replace Any Nulls with Empty Spaces ('')
|
||||||
|
Set @RoidKey = dbo.vefn_Clean(@Roid, 1, null);
|
||||||
|
|
||||||
|
-- Check if Roid is Null/Empty
|
||||||
|
If (Len(@RoidKey) > 0)
|
||||||
|
Begin
|
||||||
|
|
||||||
|
-- Roid Cleanup / Consistency Checks
|
||||||
|
Set @RoidKey = Upper(@RoidKey); -- Force Upper Case
|
||||||
|
Set @RoidKey = Replace(@RoidKey, '<U>', '<U-NUMBER>'); -- Replace Any Abbreviated Unit Info Tags
|
||||||
|
Set @RoidKey = Replace(@RoidKey, ' ', ''); -- Remove Any Internal Spaces
|
||||||
|
|
||||||
|
-- Check if Roid is a Unit Info Tag or RO Child
|
||||||
|
If (Not @RoidKey like '<U-%')
|
||||||
|
Begin
|
||||||
|
|
||||||
|
-- Check Roid Length
|
||||||
|
If (Len(@RoidKey) < 12) Set @RoidKey = Left(@RoidKey + '000000000000', 12);
|
||||||
|
|
||||||
|
-- Check if Roid is less than (16) Digits and the Check16Digits flag is set to True (
|
||||||
|
If (Len(@RoidKey) < 16 And @Check16Digits >= 1) Set @RoidKey = Left(@RoidKey, 12) + '0041';
|
||||||
|
|
||||||
|
-- Check Roid Extension (If Any) and Fix Default Extension ifusing the old format "0000"
|
||||||
|
If (Len(@RoidKey) = 16 And Right(@RoidKey, 4) = '0000') Set @RoidKey = Left(@RoidKey, 12) + '0041';
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
Return @RoidKey;
|
||||||
|
|
||||||
|
End
|
||||||
|
Go
|
||||||
|
|
||||||
|
|
||||||
|
IF (@@Error = 0) PRINT 'Function Creation: [vefn_RofstDataFormatRoidKey] Succeeded'
|
||||||
|
ELSE PRINT 'Function Creation: [vefn_RofstDataFormatRoidKey] Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If Exists(Select * From sys.objects Where type = 'TF' And object_id = OBJECT_ID('[dbo].[FindRoUsages]'))
|
||||||
|
Drop Function [dbo].[FindRoUsages];
|
||||||
|
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.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
-- ==========================================================================================
|
||||||
|
-- Author: Rich Mark
|
||||||
|
-- Create Date: 01/01/2018
|
||||||
|
-- Description: Returns the ContentIDs for any Procedure/WordSections that are currently
|
||||||
|
-- using any RO values in the @ROSearchString
|
||||||
|
--
|
||||||
|
-- Modified: [2022.08.19 - Jake Ropar]
|
||||||
|
-- Moved the logic for the Roid case statements into a new function [dbo].[vefn_RofstDataFormatRoidKey].
|
||||||
|
-- This standard roid formatting logic can now be utilized by any other objects in the database
|
||||||
|
-- like (Views/Procs/FUnctions/etc.) to ensure consistency when comparing roids.
|
||||||
|
-- I also added additional logic to support any (16) digit roids that are still using the older default
|
||||||
|
-- roid ext of "0000" instead of the new standard format "0041".
|
||||||
|
--
|
||||||
|
-- Examples: 1) Declare @ROSearchString VarChar(Max) = '1:000200000089'; Select * From FindRoUsages(ROSearchString);
|
||||||
|
-- 2) Select * From FindRoUsages('1:000200000089');
|
||||||
|
-- ==========================================================================================
|
||||||
|
|
||||||
|
Create Function [dbo].[FindRoUsages](@ROSearchString VarChar(Max))
|
||||||
|
Returns @Results Table
|
||||||
|
(
|
||||||
|
ContentID int Primary Key
|
||||||
|
)
|
||||||
|
With Execute as Owner
|
||||||
|
Begin
|
||||||
|
|
||||||
|
Insert Into @Results
|
||||||
|
|
||||||
|
Select ru.ContentID as 'ContentID'
|
||||||
|
From ROUsages ru with (NoLock)
|
||||||
|
inner join vefn_SplitROSearch(@ROSearchString) rr on rr.RODbID = ru.RODbID
|
||||||
|
And dbo.vefn_RofstDataFormatRoidKey(ru.Roid, 1) like rr.Roid + '%' Collate SQL_Latin1_General_CP1_CI_AS
|
||||||
|
|
||||||
|
Union
|
||||||
|
|
||||||
|
Select e.ContentID as 'ContentID'
|
||||||
|
From Entries e with (NoLock)
|
||||||
|
inner join DROUsages ru with (NoLock) on ru.DocID = e.DocID
|
||||||
|
inner join vefn_SplitROSearch(@ROSearchString) rr on rr.RODbID = ru.RODbID
|
||||||
|
And dbo.vefn_RofstDataFormatRoidKey(ru.Roid, 1) like rr.Roid + '%' Collate SQL_Latin1_General_CP1_CI_AS
|
||||||
|
|
||||||
|
Option (Recompile);
|
||||||
|
|
||||||
|
Return;
|
||||||
|
End
|
||||||
|
Go
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF (@@Error = 0) PRINT 'Function Creation: [FindRoUsages] Succeeded'
|
||||||
|
ELSE PRINT 'Function Creation: [FindRoUsages] Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
==========================================================================================================
|
||||||
|
End: B2022-104: SearchReferenced Objects in PROMS is not finding any results
|
||||||
|
==========================================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
@ -21289,8 +21455,8 @@ BEGIN TRY -- Try Block
|
|||||||
DECLARE @RevDate varchar(255)
|
DECLARE @RevDate varchar(255)
|
||||||
DECLARE @RevDescription varchar(255)
|
DECLARE @RevDescription varchar(255)
|
||||||
|
|
||||||
set @RevDate = '08/16/2022 10:00 AM'
|
set @RevDate = '08/23/2022 7:00 AM'
|
||||||
set @RevDescription = 'B2022-088: [JPR] Find Doc Ro button not working in Word Sections & B2022-098: [JPR] ROs not being resolved in Word Sections '
|
set @RevDescription = 'B2022-104: [JPR] SearchReferenced Objects in PROMS is not finding any results'
|
||||||
|
|
||||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||||
|
@ -20996,15 +20996,15 @@ BEGIN TRY -- Try Block
|
|||||||
|
|
||||||
|
|
||||||
SELECT [ContentID],[Number],[Text],[Type],[FormatID],[Config],[DTS],[UserID],[LastChanged],
|
SELECT [ContentID],[Number],[Text],[Type],[FormatID],[Config],[DTS],[UserID],[LastChanged],
|
||||||
(SELECT COUNT(*) FROM [Details] WHERE [Details].[ContentID]=[Contents].[ContentID]) [DetailCount],
|
(SELECT COUNT(1) FROM [Details] WHERE [Details].[ContentID]=[Contents].[ContentID]) [DetailCount],
|
||||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[ContentID]=[Contents].[ContentID]) [EntryCount],
|
(SELECT COUNT(1) FROM [Entries] WHERE [Entries].[ContentID]=[Contents].[ContentID]) [EntryCount],
|
||||||
(SELECT COUNT(*) FROM [Grids] WHERE [Grids].[ContentID]=[Contents].[ContentID]) [GridCount],
|
(SELECT COUNT(1) FROM [Grids] WHERE [Grids].[ContentID]=[Contents].[ContentID]) [GridCount],
|
||||||
(SELECT COUNT(*) FROM [Images] WHERE [Images].[ContentID]=[Contents].[ContentID]) [ImageCount],
|
(SELECT COUNT(1) FROM [Images] WHERE [Images].[ContentID]=[Contents].[ContentID]) [ImageCount],
|
||||||
(SELECT COUNT(*) FROM [Items] WHERE [Items].[ContentID]=[Contents].[ContentID]) [ItemCount],
|
(SELECT COUNT(1) FROM [Items] WHERE [Items].[ContentID]=[Contents].[ContentID]) [ItemCount],
|
||||||
(SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ContentID]=[Contents].[ContentID]) [PartCount],
|
(SELECT COUNT(1) FROM [Parts] WHERE [Parts].[ContentID]=[Contents].[ContentID]) [PartCount],
|
||||||
(SELECT COUNT(*) FROM [RoUsages] WHERE [RoUsages].[ContentID]=[Contents].[ContentID]) [RoUsageCount],
|
(SELECT COUNT(1) FROM [RoUsages] WHERE [RoUsages].[ContentID]=[Contents].[ContentID]) [RoUsageCount],
|
||||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[FromID]=[Contents].[ContentID]) [TransitionCount],
|
(SELECT COUNT(1) FROM [Transitions] WHERE [Transitions].[FromID]=[Contents].[ContentID]) [TransitionCount],
|
||||||
(SELECT COUNT(*) FROM [ZContents] WHERE [ZContents].[ContentID]=[Contents].[ContentID]) [ZContentCount]
|
(SELECT COUNT(1) FROM [ZContents] WHERE [ZContents].[ContentID]=[Contents].[ContentID]) [ZContentCount]
|
||||||
FROM [Contents] where ContentID in (Select ID From @Enh1)
|
FROM [Contents] where ContentID in (Select ID From @Enh1)
|
||||||
|
|
||||||
IF( @@TRANCOUNT > 0 ) COMMIT
|
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||||
@ -21252,8 +21252,174 @@ GO
|
|||||||
==========================================================================================================
|
==========================================================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
==========================================================================================================
|
||||||
|
Start: B2022-104: SearchReferenced Objects in PROMS is not finding any results
|
||||||
|
==========================================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
If Exists (Select * From sys.Indexes Where Name = N'IX_tblROUsagesRODbIDDeleteStatusContentID')
|
||||||
|
Drop Index [IX_tblROUsagesRODbIDDeleteStatusContentID] on [dbo].[tblROUsages]
|
||||||
|
Go
|
||||||
|
|
||||||
|
CREATE NONCLUSTERED INDEX [IX_tblROUsagesRODbIDDeleteStatusContentID]
|
||||||
|
ON [dbo].[tblROUsages] ([RODbID],[DeleteStatus])
|
||||||
|
INCLUDE ([ContentID],[ROID])
|
||||||
|
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
IF (@@Error = 0) PRINT 'Index Creation: [IX_tblROUsagesRODbIDDeleteStatusContentID] Succeeded'
|
||||||
|
ELSE PRINT 'Index Creation: [IX_tblROUsagesRODbIDDeleteStatusContentID] Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If Exists(SELECT * FROM sys.objects Where name = 'vefn_RofstDataFormatRoidKey' AND type in (N'FN'))
|
||||||
|
DROP FUNCTION [dbo].[vefn_RofstDataFormatRoidKey]
|
||||||
|
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.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
-- ==========================================================================================
|
||||||
|
-- Author: Jake Ropar
|
||||||
|
-- Create Date: 08/19/2022
|
||||||
|
-- Description: Cleans/Formats the specified roid key, with its return value ext if applicable
|
||||||
|
-- ==========================================================================================
|
||||||
|
|
||||||
|
Create Function [dbo].[vefn_RofstDataFormatRoidKey](@Roid VarChar(25), @Check16Digits bit = 0) Returns VarChar(Max)
|
||||||
|
With Execute As Owner
|
||||||
|
Begin
|
||||||
|
|
||||||
|
Declare @RoidKey VarChar(Max) = '';
|
||||||
|
|
||||||
|
-- Trim Start/End and Replace Any Nulls with Empty Spaces ('')
|
||||||
|
Set @RoidKey = dbo.vefn_Clean(@Roid, 1, null);
|
||||||
|
|
||||||
|
-- Check if Roid is Null/Empty
|
||||||
|
If (Len(@RoidKey) > 0)
|
||||||
|
Begin
|
||||||
|
|
||||||
|
-- Roid Cleanup / Consistency Checks
|
||||||
|
Set @RoidKey = Upper(@RoidKey); -- Force Upper Case
|
||||||
|
Set @RoidKey = Replace(@RoidKey, '<U>', '<U-NUMBER>'); -- Replace Any Abbreviated Unit Info Tags
|
||||||
|
Set @RoidKey = Replace(@RoidKey, ' ', ''); -- Remove Any Internal Spaces
|
||||||
|
|
||||||
|
-- Check if Roid is a Unit Info Tag or RO Child
|
||||||
|
If (Not @RoidKey like '<U-%')
|
||||||
|
Begin
|
||||||
|
|
||||||
|
-- Check Roid Length
|
||||||
|
If (Len(@RoidKey) < 12) Set @RoidKey = Left(@RoidKey + '000000000000', 12);
|
||||||
|
|
||||||
|
-- Check if Roid is less than (16) Digits and the Check16Digits flag is set to True (
|
||||||
|
If (Len(@RoidKey) < 16 And @Check16Digits >= 1) Set @RoidKey = Left(@RoidKey, 12) + '0041';
|
||||||
|
|
||||||
|
-- Check Roid Extension (If Any) and Fix Default Extension ifusing the old format "0000"
|
||||||
|
If (Len(@RoidKey) = 16 And Right(@RoidKey, 4) = '0000') Set @RoidKey = Left(@RoidKey, 12) + '0041';
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
Return @RoidKey;
|
||||||
|
|
||||||
|
End
|
||||||
|
Go
|
||||||
|
|
||||||
|
|
||||||
|
IF (@@Error = 0) PRINT 'Function Creation: [vefn_RofstDataFormatRoidKey] Succeeded'
|
||||||
|
ELSE PRINT 'Function Creation: [vefn_RofstDataFormatRoidKey] Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If Exists(Select * From sys.objects Where type = 'TF' And object_id = OBJECT_ID('[dbo].[FindRoUsages]'))
|
||||||
|
Drop Function [dbo].[FindRoUsages];
|
||||||
|
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.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
-- ==========================================================================================
|
||||||
|
-- Author: Rich Mark
|
||||||
|
-- Create Date: 01/01/2018
|
||||||
|
-- Description: Returns the ContentIDs for any Procedure/WordSections that are currently
|
||||||
|
-- using any RO values in the @ROSearchString
|
||||||
|
--
|
||||||
|
-- Modified: [2022.08.19 - Jake Ropar]
|
||||||
|
-- Moved the logic for the Roid case statements into a new function [dbo].[vefn_RofstDataFormatRoidKey].
|
||||||
|
-- This standard roid formatting logic can now be utilized by any other objects in the database
|
||||||
|
-- like (Views/Procs/FUnctions/etc.) to ensure consistency when comparing roids.
|
||||||
|
-- I also added additional logic to support any (16) digit roids that are still using the older default
|
||||||
|
-- roid ext of "0000" instead of the new standard format "0041".
|
||||||
|
--
|
||||||
|
-- Examples: 1) Declare @ROSearchString VarChar(Max) = '1:000200000089'; Select * From FindRoUsages(ROSearchString);
|
||||||
|
-- 2) Select * From FindRoUsages('1:000200000089');
|
||||||
|
-- ==========================================================================================
|
||||||
|
|
||||||
|
Create Function [dbo].[FindRoUsages](@ROSearchString VarChar(Max))
|
||||||
|
Returns @Results Table
|
||||||
|
(
|
||||||
|
ContentID int Primary Key
|
||||||
|
)
|
||||||
|
With Execute as Owner
|
||||||
|
Begin
|
||||||
|
|
||||||
|
Insert Into @Results
|
||||||
|
|
||||||
|
Select ru.ContentID as 'ContentID'
|
||||||
|
From ROUsages ru with (NoLock)
|
||||||
|
inner join vefn_SplitROSearch(@ROSearchString) rr on rr.RODbID = ru.RODbID
|
||||||
|
And dbo.vefn_RofstDataFormatRoidKey(ru.Roid, 1) like rr.Roid + '%' Collate SQL_Latin1_General_CP1_CI_AS
|
||||||
|
|
||||||
|
Union
|
||||||
|
|
||||||
|
Select e.ContentID as 'ContentID'
|
||||||
|
From Entries e with (NoLock)
|
||||||
|
inner join DROUsages ru with (NoLock) on ru.DocID = e.DocID
|
||||||
|
inner join vefn_SplitROSearch(@ROSearchString) rr on rr.RODbID = ru.RODbID
|
||||||
|
And dbo.vefn_RofstDataFormatRoidKey(ru.Roid, 1) like rr.Roid + '%' Collate SQL_Latin1_General_CP1_CI_AS
|
||||||
|
|
||||||
|
Option (Recompile);
|
||||||
|
|
||||||
|
Return;
|
||||||
|
End
|
||||||
|
Go
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF (@@Error = 0) PRINT 'Function Creation: [FindRoUsages] Succeeded'
|
||||||
|
ELSE PRINT 'Function Creation: [FindRoUsages] Error on Creation'
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
==========================================================================================================
|
||||||
|
End: B2022-104: SearchReferenced Objects in PROMS is not finding any results
|
||||||
|
==========================================================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
@ -21289,8 +21455,8 @@ BEGIN TRY -- Try Block
|
|||||||
DECLARE @RevDate varchar(255)
|
DECLARE @RevDate varchar(255)
|
||||||
DECLARE @RevDescription varchar(255)
|
DECLARE @RevDescription varchar(255)
|
||||||
|
|
||||||
set @RevDate = '08/16/2022 10:00 AM'
|
set @RevDate = '08/23/2022 7:00 AM'
|
||||||
set @RevDescription = 'B2022-088: [JPR] Find Doc Ro button not working in Word Sections & B2022-098: [JPR] ROs not being resolved in Word Sections '
|
set @RevDescription = 'B2022-104: [JPR] SearchReferenced Objects in PROMS is not finding any results'
|
||||||
|
|
||||||
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription
|
||||||
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription
|
||||||
|
Loading…
x
Reference in New Issue
Block a user