DateDiff function in SQl written in VB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cptcanada
    New Member
    • May 2008
    • 19

    DateDiff function in SQl written in VB

    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@pes l.com'

    Declare MyCursor Cursor For

    select EmpID, expirery_date from driver_licence_ abstract where DateDIFF('d',no w(), 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_s endmail @MyRecipients, @MyMessage

    Fetch Next From MyCursor Into @EmpID, @expirery_date

    End

    Close MyCursor

    Deallocate MyCursor
  • CyberSoftHari
    Recognized Expert Contributor
    • Sep 2007
    • 488

    #2
    You have to try with getdate() in Sql Server.

    Comment

    Working...