--For Single Quote Special Character, need to use Single quote 2 times.
CHARINDEX :
charindex('"',BRule)
LEAD & LAG :
select RId,a.t_Attribute, LEAD(a.t_Attribute) over(partition by RId,a.Ctribute order by RId,a.Ctribute) Leadvalue, LAG(a.t_Attribute) over(partition by RId,a.Ctribute order by RId,a.Ctribute) LagValue,a.Ctribute
from PCOLS
SUBSTRING & REPLACE :
1)substring(ppin,1,len(RIdentifier)
2)replace(brule,'.','_')
CHARINDEX :
charindex('"',BRule)
LEAD & LAG :
select RId,a.t_Attribute, LEAD(a.t_Attribute) over(partition by RId,a.Ctribute order by RId,a.Ctribute) Leadvalue, LAG(a.t_Attribute) over(partition by RId,a.Ctribute order by RId,a.Ctribute) LagValue,a.Ctribute
from PCOLS
SUBSTRING & REPLACE :
1)substring(ppin,1,len(RIdentifier)
2)replace(brule,'.','_')