-2
create table timetable2 
(
 office_start_time datetime, office_end_time datetime,
 first_break_start_time datetime, first__break_end_time datetime,
 office_start2_time datetime, office_start2_end_time datetime,
 second_break_start_time datetime,second_break_end_time datetime,
 employee_od_start_time datetime,employee_od_job_time datetime
)

insert into timetable2 values
('2013-09-02 08:00:31.773','2013-09-02 12:00:31.773',
 '2013-09-02 11:00:31.773','2013-09-02 11:30:31.773',
 '2013-09-02 12:00:31.773','2013-09-02 18:00:31.773',
 '2013-09-02 15:30:31.773','2013-09-02 16:00:31.773',
 '2013-09-02 09:00:31.773','2013-09-02 10:00:31.773')

结果将是 8.00,10.00,11.30,16.00

4

2 回答 2

0
SELECT OFFICE_START_TIME,
EMPLOYEE_OD_JOB_TIME,
FIRST__BREAK_END_TIME,
SECOND_BREAK_END_TIME
from timetable2;

样品小提琴

如果您只需要时间部分:

SELECT 
cast(OFFICE_START_TIME as time) as OFFICE_START_TIME,
cast(EMPLOYEE_OD_JOB_TIME as time) as EMPLOYEE_OD_JOB_TIME,
cast(FIRST__BREAK_END_TIME as time) as FIRST__BREAK_END_TIME,
cast(SECOND_BREAK_END_TIME as time) as SECOND_BREAK_END_TIME
from timetable2;

样品小提琴

于 2013-09-03T04:54:03.047 回答
0

这个代码会做..!!

   select cast(ColumnName as time) [time]
    from yourtable
于 2013-09-03T04:54:45.187 回答