declare @b int
set @b= 452876
select REVERSE(cast(convert(float,@b)-LEFT(@b,2) as float))
-----------------------
138254(1 行受影响)
没有乱码啊....我是SQL Server2005

解决方案 »

  1.   

    select b,
           reverse(cast(b as float) - left(b,2))
    from
    (
    select '452876' as b
    )t
      

  2.   


    --試試以下:
    DECLARE @b VARCHAR(10)
    SET @b='452876'
    SELECT REVERSE(CAST(CAST(@b AS INT)-LEFT(@b,2) AS VARCHAR(10)))
      

  3.   

    select b,
           reverse(cast(b as float) - left(b,2)) as v
    from
    (
    select '452876' as b
    )t
    /*
    b v
    452876 138254
    */
      

  4.   


    declare @x varchar(10)
    select @x='452876'select reverse(rtrim(cast(@x as int)-cast(left(@x,2) as int))) 'y'/*
    y
    ------------
    138254(1 row(s) affected)
    */