解决方案 »

  1.   

    试试这个:
    --drop table acreate table a(b nvarchar(100))insert into a
    select '0244ml招财招福(餐具组合)' union all
    select '0247ml台灯' union all
    select '0258#顺适宝钻石1号尖匙' union all
    select '0260#顺适宝钻石1号叉' union all
    select '0262#顺适宝钻花2号尖匙'
    go
    select 
           left(b,patindex('%[吖-座]%',b)-1) as '提取出的数字'
    from a
    /*
    提取出的数字
    0244ml
    0247ml
    0258#
    0260#
    0262#
    */
      

  2.   

    执行的时候,会提示出错。。这个错误
    服务器: 消息 536,级别 16,状态 3,行 1
    向 substring 函数传递了无效的 length 参数。
      

  3.   

    上面的代码中没有用到substring函数,是不是原来的提取中文的代码,运行报的错
      

  4.   

     
    select *
           
    from a
    WHERE LEFT(b,1) NOT BETWEEN '0' AND '1'这个查一下?
      

  5.   

    SELECT stuff(b,patindex('%[吖-座]%',b),len(b)-patindex('%[吖-座]%',b)+1,'') as '提取出的数字'
    from a