This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
-- Create a Summary of various Links within Procedure text
|
||||
select StartCount,EndCount,StartStartCount,EndEndCount
|
||||
, case stat when 0 then 'Good - Matching Starts and Ends' when 1 then 'Bad - Multiple Starts' else 'Bad - Requires Manual Fix' end Status
|
||||
, Count(*) HowMany
|
||||
from (
|
||||
select ContentID, StartCount,EndCount,StartStartCount,EndEndCount
|
||||
, case when StartCount=EndCount and StartStartCount = 0 and EndEndCount = 0 then 0
|
||||
when StartCount = EndCount+StartStartCount and EndEndCount = 0 then 1
|
||||
else 2 end Stat
|
||||
from (
|
||||
select ContentID
|
||||
, (Len(text)-len(replace(text,'<START]','')))/7 StartCount
|
||||
, (Len(text)-len(replace(text,'[END>','')))/5 EndCount
|
||||
, (Len(text)-len(replace(text,'<START]<START]','')))/14 StartStartCount
|
||||
, (Len(text)-len(replace(text,'[END>[END>','')))/10 EndEndCount
|
||||
From Contents) T1 ) t2
|
||||
Group By Stat,StartCount,EndCount,StartStartCount,EndEndCount
|
||||
Order By Stat,StartStartCount,EndEndCount,abs(StartCount-EndCount),StartCount,EndCount
|
@@ -0,0 +1,15 @@
|
||||
--Find Bad formatted links (Transitions or Referenced Objects) which can be fixed by running FixBadLinkFormatStartStart.sql
|
||||
select VN.* , Vi.ItemID, dbo.ve_GetShortPath(VI.ItemID) Location from vefn_GetVersionProcedureItems('') vi
|
||||
JOIN VEFN_GetVersionNames() VN ON VI.VersionID = VN.VersionID
|
||||
JOIN Contents CC ON VI.ContentID = CC.ContentID
|
||||
where VI.ContentID IN(select ContentID from ( select ContentID, StartCount,EndCount,StartStartCount,EndEndCount
|
||||
, case when StartCount=EndCount and StartStartCount = 0 and EndEndCount = 0 then 0
|
||||
when StartCount = EndCount+StartStartCount and EndEndCount = 0 then 1
|
||||
else 2 end Stat
|
||||
from (
|
||||
select ContentID
|
||||
, (Len(text)-len(replace(text,'<START]','')))/7 StartCount
|
||||
, (Len(text)-len(replace(text,'[END>','')))/5 EndCount
|
||||
, (Len(text)-len(replace(text,'<START]<START]','')))/14 StartStartCount
|
||||
, (Len(text)-len(replace(text,'[END>[END>','')))/10 EndEndCount
|
||||
From Contents) T1 ) t2 Where Stat= 1) Order By vi.VersionId,ProcId,Location
|
@@ -0,0 +1,12 @@
|
||||
-- Fix Occurences of Links (Transitions or Referenced Objects) where the Start tag is repeated
|
||||
update Contents set text = Replace(Text,'<START]<START]','<START]') where ContentID IN(select ContentID from ( select ContentID, StartCount,EndCount,StartStartCount,EndEndCount
|
||||
, case when StartCount=EndCount and StartStartCount = 0 and EndEndCount = 0 then 0
|
||||
when StartCount = EndCount+StartStartCount and EndEndCount = 0 then 1
|
||||
else 2 end Stat
|
||||
from (
|
||||
select ContentID
|
||||
, (Len(text)-len(replace(text,'<START]','')))/7 StartCount
|
||||
, (Len(text)-len(replace(text,'[END>','')))/5 EndCount
|
||||
, (Len(text)-len(replace(text,'<START]<START]','')))/14 StartStartCount
|
||||
, (Len(text)-len(replace(text,'[END>[END>','')))/10 EndEndCount
|
||||
From Contents) T1 ) t2 Where Stat= 1)
|
@@ -0,0 +1,15 @@
|
||||
--Find Locations of Bad Links which must be corrected manually. Must Copy Step Text, delete step and add step
|
||||
select VN.* , Vi.ItemID, dbo.ve_GetShortPath(VI.ItemID) Location from vefn_GetVersionProcedureItems('') vi
|
||||
JOIN VEFN_GetVersionNames() VN ON VI.VersionID = VN.VersionID
|
||||
JOIN Contents CC ON VI.ContentID = CC.ContentID
|
||||
where VI.ContentID IN(select ContentID from ( select ContentID, StartCount,EndCount,StartStartCount,EndEndCount
|
||||
, case when StartCount=EndCount and StartStartCount = 0 and EndEndCount = 0 then 0
|
||||
when StartCount = EndCount+StartStartCount and EndEndCount = 0 then 1
|
||||
else 2 end Stat
|
||||
from (
|
||||
select ContentID
|
||||
, (Len(text)-len(replace(text,'<START]','')))/7 StartCount
|
||||
, (Len(text)-len(replace(text,'[END>','')))/5 EndCount
|
||||
, (Len(text)-len(replace(text,'<START]<START]','')))/14 StartStartCount
|
||||
, (Len(text)-len(replace(text,'[END>[END>','')))/10 EndEndCount
|
||||
From Contents) T1 ) t2 Where Stat= 2) Order By vi.VersionId,ProcId,Location
|
Reference in New Issue
Block a user