create table [TB] (col varchar(33)) insert into [TB] select 'WGEN.Other.Ra.F32.15s2' union all select 'www.Other.bbb.F32.60s2' union all select 'www.Other1.bbab.F32.10m2' union all select 'www.Other.bbab.F32.Hpitch3' union all select 'www.Other.bbab.b0.AcVola.High' union all select 'www.Other.bbb.b0.AcVola.Low' union all select 'www.Other1.bbb.b0.IGBT.BreakFault' union all select 'www.Other.zbbb.b0.IGBT.Fault' union all select 'www.Other.er.b0.IGBT.NetFault' union all select 'www.Other.bb.b0.overCur'select * from [TB] SELECT * FROM tb WHERE LEN(col) - LEN(REPLACE(col, '.', '')) = 5/* www.Other.bbab.b0.AcVola.High www.Other.bbb.b0.AcVola.Low www.Other1.bbb.b0.IGBT.BreakFault www.Other.zbbb.b0.IGBT.Fault www.Other.er.b0.IGBT.NetFault*/
insert into [TB]
select 'WGEN.Other.Ra.F32.15s2' union all
select 'www.Other.bbb.F32.60s2' union all
select 'www.Other1.bbab.F32.10m2' union all
select 'www.Other.bbab.F32.Hpitch3' union all
select 'www.Other.bbab.b0.AcVola.High' union all
select 'www.Other.bbb.b0.AcVola.Low' union all
select 'www.Other1.bbb.b0.IGBT.BreakFault' union all
select 'www.Other.zbbb.b0.IGBT.Fault' union all
select 'www.Other.er.b0.IGBT.NetFault' union all
select 'www.Other.bb.b0.overCur'select * from [TB]
SELECT *
FROM tb
WHERE LEN(col) - LEN(REPLACE(col, '.', '')) = 5/*
www.Other.bbab.b0.AcVola.High
www.Other.bbb.b0.AcVola.Low
www.Other1.bbb.b0.IGBT.BreakFault
www.Other.zbbb.b0.IGBT.Fault
www.Other.er.b0.IGBT.NetFault*/
www.Other.bbb.b0.AcVola.Low
www.Other1.bbb.b0.IGBT.BreakFault
www.Other.zbbb.b0.IGBT.Fault
www.Other.er.b0.IGBT.NetFault取出这些值后我最后实现的是,将最后一个点用REPLACE掉。返回
www.Other.bbab.b0.AcVolaHigh
www.Other.bbb.b0.AcVolaLow
www.Other1.bbb.b0.IGBTBreakFault
www.Other.zbbb.b0.IGBTFault
www.Other.er.b0.IGBTNetFault
谢谢