上次发了的吧?
这个东西很难完全匹配。。
试试
declare @t table(Called_Station_Id varchar(20),F_User_point numeric(8,2),h323_connect_Time datetime)  
insert into @t select '0411990002','0.04','2008/03/21 10:15:57' 
insert into @t select '042913842922224','0.54','2008/03/20 09:46:55'
insert into @t select '042913898935335','0.09','2008/03/20 09:27:22'
insert into @t select '04293991150','0.09','2008/03/20 08:25:21'
insert into @t select '0411990001','0.04','2008/03/17 17:14:52'
insert into @t select '0429990002','0.04','2008/03/17 14:14:54'
insert into @t select '029990004','0.15','2008/03/15 12:15:56'select * from @t where 
patindex('[0-9][0-9][0-9]99[0-9][0-9][0-9][0-9]',Called_Station_Id)>0
or
patindex('[0-9][0-9][0-9][0-9]99[0-9][0-9][0-9][0-9]',Called_Station_Id)>0

解决方案 »

  1.   

    需要在这个语句上怎么修改呢?
    select Called_Station_Id,F_User_point,h323_connect_Time from TB_CDR where Calling_Station_Id='0429990001'  
    and Called_Station_Id like '0[1-9]%'  
    and len(substring(Called_Station_Id,charindex('99',Called_Station_Id)+2,len(Called_Station_Id)))>4 
    and convert (varchar(10),convert(dateTime, h323_connect_Time),112) like '200803%'  
      

  2.   


    --try:
    select Called_Station_Id,F_User_point,h323_connect_Time from TB_CDR where Calling_Station_Id='0429990001'   
    and Called_Station_Id like '0[1-9]%'   
    and patindex('[0-9][0-9][0-9]99[0-9][0-9][0-9][0-9]',Called_Station_Id)!>0
    and patindex('[0-9][0-9][0-9][0-9]99[0-9][0-9][0-9][0-9]',Called_Station_Id)!>0
    and convert (varchar(10),convert(dateTime, h323_connect_Time),112) like '200803%'