我的表的某列为当日时间(类型为DATETIME),只需要显示00:00:00的时间,不需要显示年月日
虽然我插入的是HH:MM:SS的格式,但是它是显示为YY-MM-DD HH:MM:SS.000000我查看了帮助,可是我建表的时候找不到TIME类型不知道该怎么办了?

解决方案 »

  1.   

    select convert(varchar(10),getdate(),108)
      

  2.   

    declare @t table([date] datetime)
    insert @t select '2008-11-05 21:05:41.313'
    select convert(varchar(10),[date],24) from @t
    /*           
    ---------- 
    21:05:41(所影响的行数为 1 行)
    */
      

  3.   

    if not object_id('tb') is null
    drop table tb
    go
    create table tb( id int identity(1,1), dt datetime, time as substring(cast(dt as varchar),11,20))insert into tb(dt)
    values('2008-11-13 4:06:00.000')select * from tb
    1 2008-11-13 04:06:00.000   4:06AM看看这么对你有帮助吗?需要添加一个辅助列
      

  4.   

    看看time列,显示的是几点几分