本文介绍了如何在SQL中过滤columntype time(7)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Dear,
I have a Column Name Emp_InTime DataType time(7). The Data is below.
Emp_Name Emp_InTime
A 08:00:00
B 08:19:00
C 08:00:00
D 09:00:00
Now i want to filter who is coming after 08:15:00
How to do it in SQL.
Thanks
Basit.
我的尝试:
从出勤地点选择*(Emp_InTime> CONVERT(DATETIME,'2016-05-08 08:15:00',102))
What I have tried:
Select * from Attendance WHERE (Emp_InTime > CONVERT(DATETIME, '2016-05-08 08:15:00', 102))
推荐答案
SELECT * FROM Attendance WHERE (Emp_InTime > CONVERT(TIME(7), '2016-05-08 08:15:00', 102))
declare @in_time TIME;
set @in_time = CONVERT(TIME, '08:17:00');
select IIF(@in_time > CONVERT(TIME, '08:15:00'), 'late', 'on time');
go;
这篇关于如何在SQL中过滤columntype time(7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!