Preparation for Delete logic and Format Variable Search
This commit is contained in:
parent
9230be8fa8
commit
9e45e5601d
@ -9251,6 +9251,7 @@ Union All
|
||||
where Z.[Level] > 0
|
||||
)
|
||||
Select @Count = Count(*) from Itemz
|
||||
OPTION (MAXRECURSION 10000)
|
||||
return @Count END;
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
@ -9575,7 +9576,7 @@ from Items II join Contents CC on II.ContentID = CC.ContentID
|
||||
where ItemID in(111,265,266,267)
|
||||
*/
|
||||
-- drop function ve_GetPath
|
||||
Create FUNCTION [dbo].[ve_GetShortPath] (@ItemID int) RETURNS varchar(max)
|
||||
CREATE FUNCTION [dbo].[ve_GetShortPath] (@ItemID int) RETURNS varchar(max)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
@ -9635,7 +9636,7 @@ with Itemz(ItemCount,ItemID,PreviousID,FromType,CType,Number,Text,PPath, Path) a
|
||||
)
|
||||
select @Path = path From Itemz where ItemCount=1 and CType=0
|
||||
OPTION (MAXRECURSION 10000)
|
||||
return @Path
|
||||
return REPLACE(@Path,'\u8209?','-')
|
||||
END;
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
@ -10236,8 +10237,12 @@ Select * from vefn_FindExternalTransitions(185)
|
||||
CREATE FUNCTION [dbo].[vefn_FindExternalTransitions](@ItemID int)
|
||||
RETURNS @Children TABLE
|
||||
(
|
||||
FromItemID int,
|
||||
ToID int
|
||||
[FromItemID] int,
|
||||
[TransitionID] [int] NOT NULL,
|
||||
[FromID] [int] NOT NULL,
|
||||
[ToID] [int] NOT NULL,
|
||||
[RangeID] [int] NOT NULL,
|
||||
[Config] [nvarchar](max) NULL
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
@ -10263,7 +10268,7 @@ Union All
|
||||
where Z.[Level] > 0
|
||||
)
|
||||
insert into @Children
|
||||
select ItemID [FromItemID], case when TT.ToID in(select ItemID from Itemz) then TT.ToID else TT.RangeID end [ToID]
|
||||
select ItemID [FromItemID], TT.[TransitionID], TT.[FromID], TT.[ToID], TT.[RangeID], TT.[Config]
|
||||
from Transitions TT
|
||||
join Items II on II.ContentID=TT.FromID
|
||||
where (ToID in(select ItemID from Itemz) OR RangeID in(select ItemID from Itemz))
|
||||
@ -10523,6 +10528,89 @@ IF (@@Error = 0) PRINT 'ScalarFunction Creation: vefn_FixTransitionText Succeede
|
||||
ELSE PRINT 'ScalarFunction Creation: vefn_FixTransitionText Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vefn_GetFormatValues] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetFormatValues]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||
DROP FUNCTION [vefn_GetFormatValues];
|
||||
GO
|
||||
|
||||
/*
|
||||
|
||||
SELECT * from vefn_GetFormatValues('WidSAdjByLevel')
|
||||
SELECT * from vefn_GetFormatValues('MatchProcNumber')
|
||||
SELECT * from vefn_GetFormatValues('TofCPositionAdj')
|
||||
|
||||
*/
|
||||
|
||||
|
||||
CREATE FUNCTION [dbo].[vefn_GetFormatValues](@FieldName as varchar(255))
|
||||
RETURNS @AllValues TABLE
|
||||
(
|
||||
FormatID int,
|
||||
Name varchar(100),
|
||||
ParentNode XML,
|
||||
Node XML,
|
||||
FieldValue varchar(MAX)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
declare @NodeName as varchar(255)
|
||||
set @NodeName = (Select distinct v.value('local-name(..)', 'varchar(255)') MyName
|
||||
FROM Formats CROSS APPLY Data.nodes('(*//@*[local-name()=sql:variable("@FieldName")])') TempXML(v))
|
||||
Insert into @AllValues
|
||||
Select FormatID, Name, v.query('..') ParentNode, v.query('.') Node,
|
||||
v.value('(./@*[local-name()=sql:variable("@FieldName")])[1]','varchar(255)') FieldValue
|
||||
FROM Formats CROSS APPLY Data.nodes('(//*[local-name()=sql:variable("@NodeName")])') TempXML(v)
|
||||
RETURN
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_GetFormatValues Succeeded'
|
||||
ELSE PRINT 'TableFunction Creation: vefn_GetFormatValues Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vefn_GetNullFormatValues] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetNullFormatValues]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||
DROP FUNCTION [vefn_GetNullFormatValues];
|
||||
GO
|
||||
|
||||
/*
|
||||
|
||||
SELECT * from vefn_GetNullFormatValues('WidSAdjByLevel')
|
||||
SELECT * from vefn_GetNullFormatValues('MatchProcNumber')
|
||||
SELECT * from vefn_GetNullFormatValues('TofCPositionAdj')
|
||||
|
||||
*/
|
||||
|
||||
|
||||
CREATE FUNCTION [dbo].[vefn_GetNullFormatValues](@FieldName as varchar(255))
|
||||
RETURNS @NullValues TABLE
|
||||
(
|
||||
FormatID int,
|
||||
Name varchar(100),
|
||||
ParentNode XML,
|
||||
Node XML
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
declare @NodeName as varchar(255)
|
||||
set @NodeName = (Select distinct v.value('local-name(..)', 'varchar(255)') MyName
|
||||
FROM Formats CROSS APPLY Data.nodes('(*//@*[local-name()=sql:variable("@FieldName")])') TempXML(v))
|
||||
Insert into @NullValues
|
||||
Select FormatID, Name, ParentNode, Node FROM (
|
||||
Select FormatID, Name, v.query('..') ParentNode, v.query('.') Node,
|
||||
v.value('(./@*[local-name()=sql:variable("@FieldName")])[1]','varchar(255)') FieldValue
|
||||
FROM Formats CROSS APPLY Data.nodes('(//*[local-name()=sql:variable("@NodeName")])') TempXML(v)
|
||||
) t1 WHERE FieldValue is null
|
||||
RETURN
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_GetNullFormatValues Succeeded'
|
||||
ELSE PRINT 'TableFunction Creation: vefn_GetNullFormatValues Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vefn_HighLevelStepTransitions] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_HighLevelStepTransitions]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||
DROP FUNCTION [vefn_HighLevelStepTransitions];
|
||||
|
Loading…
x
Reference in New Issue
Block a user