Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello all,

Calculate the datediffernce. If the date is =15 days then send mail.

select * from Sample where datediff(day,StartDate,getdate())='15'

It retrieve the whole data, never check the condition.

Help pl
Posted

Try this:

SQL
SELECT * FROM Sample WHERE DATEDIFF(DAY, StartDate, GETDATE()) = 15
 
Share this answer
 
v2
Comments
praveena.karthi 30-Jul-11 21:42pm    
It also retrive the datas only

Help pl
use this type :

SQL
select * from Sample where datediff(d,StartDate,getdate())=15



hope this help
 
Share this answer
 
Here you go

How do I send e-mail from SQL Server?[^](Check To schedule mail section)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900