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.
Author |
Topic |
Keshaba
Yak Posting Veteran
52 Posts |
Posted - 2009-08-20 : 08:58:53
|
I am using sql server 2005 express.How shall I write a query to find the difference between 2 dates.I tried like this but it didn’t work properlyselect datediff(Day,Day(DateOFApp),Day(getdate())) from Beneficary where BID = 1If todays date is 20-08-2009 i.e the getdate() as in the queryAnd DateofApp is 1-08-2009 then the result is okayIt is 19 But If I change the month to 07 and other remaining same Then I get the same resultIt is 19 but the result should be 31+19= 50.How shall I solve the problemKeshab |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-08-20 : 09:02:08
|
select datediff(Day, DateOFApp, getdate()) from Beneficary where BID = 1 N 56°04'39.26"E 12°55'05.63" |
|
|
|
|
|