select top 1 @MSG= msg from( select ‘msg‘=substring(t.string,t2.number,charindex(‘。‘,t.string+‘。‘,t2.number)-t2.number) from ( select @Message as string ) t inner join master.dbo.spt_values t2 on t2.number between 1 and len(t.string) and substring(‘。‘+t.string,t2.number,1)=‘。‘ where t2.type=‘P‘ ) a where a.msg like ‘%打回失败%‘
原文:https://www.cnblogs.com/colorfulblogs/p/13628148.html