Question : check date plus 90 days

I have a query where I need to check if the date stored in the database is still active.  The formula to determine if the date is still active is if the if the Contract_End_c field is not past todays date plus 90 days.

The date stored in the database is in the format: mm/dd/yyyy

This is what I was trying:

Select a.AccountNumber, a.Contract_End__c from Account a WHERE a.AccountNumber = '123456' AND a.Contract_End_c <= DATEADD(dd, 90, getdate())

Thanks for any help.

Answer : check date plus 90 days

The date is stored in a text column?
You will need to convert it to a date

AND Cast(Right(Contract_End_c,4) + '-' + Left(Contract_End_c, 2) + '-' + SUBSTRING(Contract_End_c,4 , 2) as datetime)  <= DATEADD(dd, 90, getdate())

Random Solutions  
 
programming4us programming4us