Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 datediff

Author  Topic 

sqadil
Starting Member

11 Posts

Posted - 2009-08-15 : 03:26:36
If we run the below code we get a number what is that..?
select datediff(mm,0,getdate()) id

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-08-15 : 03:30:08
it is number of months between current date and 0 date value which is 1 jan 1900
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-08-15 : 03:36:55
Don't forget it includes the last month too.
See how DATEDIFF works here
http://www.sqlteam.com/article/datediff-function-demystified


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

sqadil
Starting Member

11 Posts

Posted - 2009-08-18 : 06:51:48
Wow..
awesome..
Hats off to you Peso, What an explanation.

Thanx a lot :)
Go to Top of Page

sqadil
Starting Member

11 Posts

Posted - 2009-08-18 : 06:56:22
Thanx for your answer visakh
Go to Top of Page
   

- Advertisement -