Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date_Add

Status
Not open for further replies.

RevelationUK

Technical User
Jun 29, 2005
6
GB
Im trying to implement the Date_Add function, but im having some problem.

SELECT tblCustomers.*
FROM tblCustomers
WHERE (((tblCustomers.State='No Letters Sent') And (tblCustomers.DateEntered<=Date_Add(Date(),INTERVAL 1 MONTH))

Gives me an error, how do i correct this? I know its a silly syntax mistake, searched and I don't understandt basically :(
 
did you mean:

WHERE (((tblCustomers.State='No Letters Sent') And (tblCustomers.DateEntered<=Date_Add(mm,Date(),1))

-DNG



 
Shouldn't it be?

Code:
SELECT tblCustomers.*
FROM tblCustomers
WHERE tblCustomers.State='No Letters Sent' And tblCustomers.DateEntered <= dateadd(mm, 1, getdate())

If you are concerned about the time too then use the convert function like below:

Code:
select dateadd(mm, 1, convert(varchar, getdate(), 101))

Regards,
AA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top