例如:
字段WG01=G1.2.3
字段WG02=011
字段WG03=003现要另字段WG04=G1.2.3-11(3)这种格式,应该用什么语句.

解决方案 »

  1.   

    WG04=WG01+'-'+ltrim(cast(WG02 as int))+'('+ltrim(cast(WG03 as int))+')'
      

  2.   

    SELECT WG04=
    WG01 + --: G1.2.3
    '-' +  --: -
    RTRIM(CAST(WG02 AS INT)) + --: 11
    '(' +  --: (
    RTRIM(CAST(WG03 AS INT)) + --: 3
    ')' --: )
    FROM tb
      

  3.   

    select wg04=WG01+ '- '+cast(WG02   as   int)+ '( '+cast(WG03   as   int)+ ') ' from 表名
      

  4.   

    select WG01+'-'+ltrim(cast(WG02 as int))+'('+ltrim(cast(WG03 as int))+')' AS WG01 from TABupdate TAB set WG04=WG01+'-'+ltrim(cast(WG02 as int))+'('+ltrim(cast(WG03 as int))+')' from TAB