3小时10分 这种就用varchar
总共的小时数就用numeric()

解决方案 »

  1.   

    数据库中存储:table1列1
    3.20
    0.10
    4.20总共的小时 numeric(sum(列1) 
      

  2.   

    把3小时20分,0小时10分,4小时50分
    以下面形式存储表中:
    列A
    3.20
    0.20
    4.50
    如果合计的话应该是
    3.20+0.30+4.50=8.67小时
    但是用:
    select sum(convert(numeric,列A)) from Table_1
    得到是8小时
    是不是存储的形式有问题
      

  3.   

    --> 测试数据: [ta]
    if object_id('[ta]') is not null drop table [ta]
     go
     create table [ta] ([col1] numeric(3,2))
    insert into [ta]
    select 3.20 union all
    select 0.20 union all
    select 4.50select sum(1.0*(floor(col1)*60+(col1-floor(col1))*100)/60) from ta8.499999