select 
cast(left(FLB_Lbbm,2)as float) as 商品大类, 
flb_lbbm as 商品类别, 
fsm_spbm as 商品编码, 
fsm_spmc as 商品名称, 
fsm_sppp as 商品品牌, 
(case fsm_spmc when 'fsm_spmc like'%原装%'' then '是' else '否' end) as 是否原装 
from TB上面的语句我想把FSM_SPMC包含原装的做个判断,但总有错误提示. 提示内容: 
服务器: 消息 207,级别 16,状态 3,行 1 
列名 '原装' 无效。 

解决方案 »

  1.   

    select
    cast(left(FLB_Lbbm,2)as float) as 商品大类,
    flb_lbbm as 商品类别,
    fsm_spbm as 商品编码,
    fsm_spmc as 商品名称,
    fsm_sppp as 商品品牌,
    case fsm_spmc when fsm_spmc like '%原装%' then '是' else '否' end as 是否原装
    from TB
      

  2.   

    select
    cast(left(FLB_Lbbm,2)as float) as 商品大类,
    flb_lbbm as 商品类别,
    fsm_spbm as 商品编码,
    fsm_spmc as 商品名称,
    fsm_sppp as 商品品牌,
    case when fsm_spmc like '%原装%' then '是' else '否' end as 是否原装
    from TB用  case when 条件 then ... else ... end as 别名
      

  3.   

    select 
    cast(left(FLB_Lbbm,2)as float) as 商品大类, 
    flb_lbbm as 商品类别, 
    fsm_spbm as 商品编码, 
    fsm_spmc as 商品名称, 
    fsm_sppp as 商品品牌, 
    (case  when   patindex('%原装%' ,fsm_spmc)>0 then '是' else '否' end) as 是否原装 
    from TB