- Datetime format = '2013-10-21 12:12:12.000'
- 语法显然很差但你可以看到我想做什么
select personnum, convert(decimal, shiftEndDate, 4)-convert(decimal, ShiftStartDate, 4) as ShiftInSeconds
from dbo.Time
where shiftStartDate between '2013-10-14 00:00:00.000' and '2013-10-20 23:59:59.000'
答案 0 :(得分:0)
您可以使用DATEFROMPARTS从date
创建shiftEndDate
类型,然后将条件字符串转换为日期/日期时间(sql server应自动执行此操作,否则使用{{3 }})