anders2002
MIS
Hi,
I am trying to compare dates in MS SQL where the dates are stored in a 'Enddate' table in this format:
dd/mm/yyyy
I am trying to return records where the Enddate is less than 3 days away, and the less than 7 and more than 3.
Can anyone help?
I cannot get datediff to work?
I am currently using this type of syntax:
SELECT Generated_by, Customer, Contact, Transport, Reason, [Key], Expire, Startdate, convert(char,enddate,3) FROM LicenceDetails where (DATEDIFF(day, Enddate, GetDate()) <= 3) ORDER BY Enddate ASC
WHen I query the db in Enterprise Manager with this query:
SELECT DATEDIFF(day, Enddate, GETDATE()) AS datedifference
FROM LicenceDetails
It seems to return minus numbers as well which I don't want returned. Has anyone got any ideas?
Cheers,
Anders
I am trying to compare dates in MS SQL where the dates are stored in a 'Enddate' table in this format:
dd/mm/yyyy
I am trying to return records where the Enddate is less than 3 days away, and the less than 7 and more than 3.
Can anyone help?
I cannot get datediff to work?
I am currently using this type of syntax:
SELECT Generated_by, Customer, Contact, Transport, Reason, [Key], Expire, Startdate, convert(char,enddate,3) FROM LicenceDetails where (DATEDIFF(day, Enddate, GetDate()) <= 3) ORDER BY Enddate ASC
WHen I query the db in Enterprise Manager with this query:
SELECT DATEDIFF(day, Enddate, GETDATE()) AS datedifference
FROM LicenceDetails
It seems to return minus numbers as well which I don't want returned. Has anyone got any ideas?
Cheers,
Anders