有个字段是datatime型 里面存的时间是'2008-10-11 12:50:00'
如何能返回仍旧是时间型的 内容为'12:50:00'
把年月日去除

解决方案 »

  1.   

    select datename(hour,getdate())+':'+datename(minute,getdate())+':'+datename(second,getdate())
      

  2.   

    select convert(char,getdate(),108)
    /*
    ------------------------------ 
    08:58:33                      (所影响的行数为 1 行)
    */
      

  3.   

    精确到毫秒select convert(char,getdate(),114)
    /*
    ------------------------------ 
    08:59:03:420                  (所影响的行数为 1 行)*/
      

  4.   


    select convert(char,getdate(),108)08:56:56                      
      

  5.   

    转换成内容为'12:50:00'  的字符串型没问题,不包括年月日就不是datatime型了
      

  6.   

    select convert(char,getdate(),108)08:56:56                      
    谢了