declare @T table([percent] nvarchar(50))
insert into @T select N'66.666666666%'
insert into @T select N'50.000000000%'
insert into @T select N'100.000000000%'
insert into @T select N'75.000000000%'
insert into @T select N'50.000000000%'
insert into @T select N'25.000000000%'
insert into @T select N'0.000000000%'
insert into @T select N'0.000000000%'
insert into @T select N'100.000000000%'
insert into @T select N'100.000000000%'select 
    rtrim(cast(round(left([percent],charindex('%',[percent])-1),0) as int))+'%'
from @T

解决方案 »

  1.   

    转换处理可以参考ROUND()函数ROUND
    返回数字表达式并四舍五入为指定的长度或精度。语法
    ROUND ( numeric_expression , length [ , function ] ) 参数
    numeric_expression精确数字或近似数字数据类型类别的表达式(bit 数据类型除外)。length是 numeric_expression 将要四舍五入的精度。length 必须是 tinyint、smallint 或int。当 length 为正数时,numeric_expression 四舍五入为 length 所指定的小数位数。当 length 为负数时,numeric_expression 则按 length 所指定的在小数点的左边四舍五入。function是要执行的操作类型。function 必须是 tinyint、smallint 或 int。如果省略 function 或 function 的值为 0(默认),numeric_expression 将四舍五入。当指定 0 以外的值时,将截断 numeric_expression。返回类型
    返回与 numeric_expression 相同的类型。
      

  2.   

    declare @T table([percent] nvarchar(50))
    insert into @T select N'66.666666666%'
    insert into @T select N'50.000000000%'
    insert into @T select N'100.000000000%'
    insert into @T select N'75.000000000%'
    insert into @T select N'50.000000000%'
    insert into @T select N'25.000000000%'
    insert into @T select N'0.000000000%'
    insert into @T select N'0.000000000%'
    insert into @T select N'100.000000000%'
    insert into @T select N'100.000000000%'select 
        rtrim(cast(round(left([percent],charindex('%',[percent])-1),0) as int))+'%'
    from @T/*
    67%
    50%
    100%
    75%
    50%
    25%
    0%
    0%
    100%
    100%
    */select 
        rtrim(cast(round(left([percent],charindex('%',[percent])-1),2) as numeric(10,2)))+'%'
    from @T/*
    66.67%
    50.00%
    100.00%
    75.00%
    50.00%
    25.00%
    0.00%
    0.00%
    100.00%
    100.00%
    */
      

  3.   

    ROUND
    返回数字表达式并四舍五入为指定的长度或精度。
      

  4.   

    lsqkeke() 
    你怎么到处要分啊?呵呵
      

  5.   

    SELECT CAST(18.4465657879879 AS numeric(8,0))
    SELECT CAST(18.4465657879879 AS numeric(8,2))18
    18.45