B2026 092 #842
@@ -18846,87 +18846,6 @@ GO
|
||||
ELSE PRINT 'Procedure Creation: [vesp_RofstHeaderFinalizeLoad] Error on Creation'
|
||||
GO
|
||||
|
||||
|
||||
|
||||
/****** Object: StoredProcedure [dbo].[vesp_RofstDataSearch] Script Date: 06/23/2022 ******/
|
||||
If Exists(SELECT * FROM sys.objects Where name = 'vesp_RofstDataSearch' AND type in (N'P'))
|
||||
DROP PROCEDURE [dbo].[vesp_RofstDataSearch]
|
||||
GO
|
||||
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2020 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
/*
|
||||
==========================================================================================================
|
||||
Author: Jake Ropar
|
||||
Create Date: 06/23/2022
|
||||
Description: RO Default Value Search
|
||||
|
||||
@SearchTypeID => (1) Starts With (2) Ends With (3) Contains (4) Exact Match
|
||||
==========================================================================================================
|
||||
*/
|
||||
Create Procedure [dbo].[vesp_RofstDataSearch]
|
||||
(
|
||||
@RofstID int,
|
||||
@Value VarChar(Max) = null,
|
||||
@SearchTypeID Int = 1, -- Starts With
|
||||
@MaxNumOfRecords Int = null
|
||||
)
|
||||
With Execute as Owner
|
||||
As
|
||||
Begin
|
||||
|
||||
-- Remove any leading/trailing white spaces
|
||||
Set @Value = dbo.vefn_Clean( @Value, 0, null );
|
||||
|
||||
-- Escape any % signs in the search value
|
||||
Set @Value = Replace( @Value, '%', '[%]' );
|
||||
|
||||
-- Format search value
|
||||
If (Len(@Value) = 0) Set @Value = null;
|
||||
|
||||
-- Create Temp Results Table
|
||||
Create Table #SearchResults
|
||||
(roid VarChar(50) Not Null, [value] VarChar(Max), RowNum Int Not Null Primary Key);
|
||||
|
||||
-- Select roids/values based on search criteria
|
||||
Insert Into #SearchResults (roid, [value], RowNum)
|
||||
Select rdv.roid,
|
||||
rdv.[value],
|
||||
Row_Number() Over (Order By rdv.[value] Asc, rdv.roid Asc) as 'RowNum'
|
||||
From vwRofstData_RofstDefaultValues rdv
|
||||
Where rdv.RofstID = @RofstID
|
||||
And ((@Value is null)
|
||||
Or (@SearchTypeID = 1 And REPLACE(rdv.[value], '@HSP(', '') like @Value + '%') -- Starts With
|
||||
Or (@SearchTypeID = 2 And REPLACE(rdv.[value], '@HSP(', '') like '%' + @Value) -- Ends With
|
||||
Or (@SearchTypeID = 3 And REPLACE(rdv.[value], '@HSP(', '') like '%' + @Value + '%') -- Contains
|
||||
Or (@SearchTypeID = 4 And rdv.[value] = @Value)) -- Exact Match
|
||||
Order By rdv.[value] Asc, rdv.roid Asc
|
||||
Option (Recompile);
|
||||
|
||||
-- Return the specified number of results
|
||||
Select sr.roid, sr.[value]
|
||||
From #SearchResults sr
|
||||
Where (@MaxNumOfRecords is null Or sr.RowNum <= @MaxNumOfRecords)
|
||||
Order By sr.RowNum Asc;
|
||||
|
||||
|
||||
Return;
|
||||
End
|
||||
Go
|
||||
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: [vesp_RofstDataSearch] Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: [vesp_RofstDataSearch] Error on Creation'
|
||||
GO
|
||||
|
||||
|
||||
|
||||
/****** Object: StoredProcedure [dbo].[vesp_RofstDataGetValueDifferences] Script Date: 06/23/2022 ******/
|
||||
If Exists(SELECT * FROM sys.objects Where name = 'vesp_RofstDataGetValueDifferences' AND type in (N'P'))
|
||||
DROP PROCEDURE [dbo].[vesp_RofstDataGetValueDifferences]
|
||||
@@ -20438,9 +20357,9 @@ GO
|
||||
Where rdv.RofstID = @RofstID
|
||||
And (@OnlyRoid16 = 0 Or Len(rdv.roid) = 16)
|
||||
And ((@Value is null)
|
||||
Or (@SearchTypeID = 1 And rdv.[value] like @Value + '%') -- Starts With
|
||||
Or (@SearchTypeID = 2 And rdv.[value] like '%' + @Value) -- Ends With
|
||||
Or (@SearchTypeID = 3 And rdv.[value] like '%' + @Value + '%') -- Contains
|
||||
Or (@SearchTypeID = 1 And REPLACE(rdv.[value], '@HSP(', '') like @Value + '%') -- Starts With
|
||||
Or (@SearchTypeID = 2 And REPLACE(rdv.[value], '@HSP(', '') like '%' + @Value) -- Ends With
|
||||
Or (@SearchTypeID = 3 And REPLACE(rdv.[value], '@HSP(', '') like '%' + @Value + '%') -- Contains
|
||||
Or (@SearchTypeID = 4 And rdv.[value] = @Value)) -- Exact Match
|
||||
Order By rdv.[value] Asc, rdv.roid Asc
|
||||
Option (Recompile);
|
||||
|
||||
Reference in new issue
Block a user