SQLServer常用个技巧(一):根据某字符截取后面的字符串,String转int

SELECT
    GOODS_CD AS goodsCd,    原字符串
    reverse( GOODS_CD ) AS dCsdoog,    颠倒
    LEFT ( reverse( GOODS_CD ), charindex( -, reverse( GOODS_CD ) ) - 1 ) AS tluser,    按符号‘-’进行分割
    reverse( LEFT ( reverse( GOODS_CD ), charindex( -, reverse( GOODS_CD ) ) - 1 ) ) AS result,    将结果倒过来
    CONVERT ( INT, reverse( LEFT ( reverse( GOODS_CD ), charindex( -, reverse( GOODS_CD ) ) - 1 ) ) ) AS resultInt   将string转成int
FROM
    PI_DSL_ORDER_GOODS og
    JOIN PI_ST_ENTRY_GOODS eg ON eg.ID = og.GOODS_ID 
    AND eg.DATA_STATUS = 1 
WHERE
    1 = 1 
    AND og.DATA_STATUS = 1 
    AND og.ORDER_ID = 484eaa92bf5d43c1bb24625688ea7464

SQLServer常用个技巧(一):根据某字符截取后面的字符串,String转int

SQLServer常用个技巧(一):根据某字符截取后面的字符串,String转int

上一篇:Mysql学习日记-07python面向对象编程


下一篇:mysql的刷脏