12 lines
		
	
	
		
			754 B
		
	
	
	
		
			SQL
		
	
	
	
	
	
			
		
		
	
	
			12 lines
		
	
	
		
			754 B
		
	
	
	
		
			SQL
		
	
	
	
	
	
| -- Fix Occurences of Links (Trnasitions or Referenced Objects) where the Start tag ins 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) |