| Author |
Topic  |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 05/22/2008 : 10:18:52
|
hi,
I HAVE THE FOLLOWING DATA
DECLARE @D1 DATETIME,@D2 DATETIME SELECT @D1 = '06/05/2005' ,@D2 = '05/22/2008'
I NEED TO GET THE DIFFERENCE BETWEEN TWO DATES
PLEASE DON'T CONSIDER ONLY YEAR PART
I.E., SELECT DATEDIFF(YEAR,@D1,@D2) IS NOT VALID IN MY CONTEXT
I need to consider the days and months also.
I need to determine whether the difference is greater than 3 years or not.
FOR THE ABOVE GIVEN DATA IT IS LESS THAN 3 YEARS IN THIS CASE I NEED TO GET OUTPUT AS LESS THAN 3 YEARS
I ALWAYS ASSIGN @D2 WITH GETDATE().
PLEASE HELP ME...
THANKS IN ADVANCE...
|
|
|
RickD
Slow But Sure Yak Herding Master
United Kingdom
3560 Posts |
Posted - 05/22/2008 : 10:20:04
|
| So change it to days to find out how many days there are different. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
Sweden
29138 Posts |
|
|
jsmith8858
Dr. Cross Join
USA
7423 Posts |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
USA
6997 Posts |
|
| |
Topic  |
|