Hi All,
I am getting an error saying that now() is not a reconized function in my datediff function would any one know why it is not being reconized?
Thanks for the help
-------------------------------------------------------------------------------------------------------------
USE Master
EXEC xp_startmail 'outlook', 'drive8'
Use inv_tracking
Declare @MyRecipients nvarchar (50)
declare @expirery_date datetime
declare @EmpID int(4)
Set @MyRecipients = 'derek.kemp@pesl.com'
Declare MyCursor Cursor For
select EmpID, expirery_date from driver_licence_abstract where DateDIFF('d',now(), expirery_date) < 90
Open MyCursor
Fetch Next From MyCursor Into @EmpID, @expirery_date
While @@Fetch_Status = 0
BEGIN
Set @MyMessage = 'Please be advised that : ' + @EmpID+ '.
Drivers Licence will expire in 3 months. Please Notifie the Branch Mangers.
The experation date is : '+ @expirery_date + '.'
Exec master.dbo.xp_sendmail @MyRecipients, @MyMessage
Fetch Next From MyCursor Into @EmpID, @expirery_date
End
Close MyCursor
Deallocate MyCursor