如何在sql Server 2008r2中截断sysdate [Getdata()]函数?

时间:2015-10-29 10:27:04

标签: sql sql-server oracle sql-server-2008-r2

甲骨文:

select j.Jobname,rg.Region,wc.Status from Job j,Region rg,Weekend_Check_Detail wc
where j.Row_id=wc.Job_ID and Region_ID=rg.Row_id
and trunc(wc.StartTime)=trunc(sysdate)
order by rg.Region

trunc(wc.StartTime)=trunc(sysdate) 我如何在sqlserver 2008中编写与上面相同的内容?

1 个答案:

答案 0 :(得分:2)

您可以使用Convert功能

前:

select   CONVERT(date, getdate())

或在你的情况下

select j.Jobname, rg.Region, wc.Status
from Job j,
     Region rg,
     Weekend_Check_Detail wc
where j.Row_id = wc.Job_ID
  and Region_ID = rg.Row_id
  and CONVERT(date, wc.StartTime) = CONVERT(date, getdate())
order by rg.Region