DateDiff Function

喜你入骨 提交于 2019-12-02 05:46:14

What database are you using?

A google search gave me this:

http://www.mssqltips.com/sqlservertip/2508/sql-server-datediff-example/

DAY SELECT DATEDIFF(DD,'09/23/2011 15:00:00','08/02/2011 14:00:00')

where 'DD' is used as opposed to 'days'.

Try answering these question:

What database I'm using?

Is the database case sensitive? This might be the error occurring with the datediff as oppose to DATEDIFF

try SELECT DATEDIFF(dd,datebegin,datestop) from table

I think 'day' also works, I was able to execute:

SELECT DATEDIFF(day,'1/1/2011','1/1/2012') 

So Im not sure what you're doing wrong.. What version of SQL Server are you using?

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!