--字符串分段截取
declare @s varchar(50),@split varchar(2),@pos int,@splitlen int
select @s='a,b,ct,d,e,f,g',@split=',',@pos=3,@splitlen=len(@split+'a')-2
while @pos>1 and charindex(@split,@s+@split)>0
select @pos=@pos-1,@s=stuff(@s,1,charindex(@split,@s+@split)+@splitlen,'')
select left(@s,charindex(@split,@s+@split)-1)
/*
--------------------------------------------------
ct
*/