help with notification email syntax

Posted on 2007-10-19
Last Modified: 2010-03-19
i am trying to send an email if this query below has matches.  i get an error.  could you help to make sure i have all single quotes

FROM         legalcontract
WHERE     (expired = 1) AND (Triggerdate >= CONVERT(varchar(10), GETDATE(), 121)) AND (Triggerdate <= DATEADD(day, 90, CONVERT(varchar(10), GETDATE(),
  EXEC msdb.dbo.sp_send_dbmail
  ,@body='Message Body'
  ,@subject ='Message Subject'
  ,@profile_name ='JMI'
Question by:gianitoo
    LVL 142

    Expert Comment

    by:Guy Hengel [angelIII / a3]
    >i get an error
    what error?

    LVL 10

    Accepted Solution

    Go through this :

    Also elaborate more on error if you are still not able to solve the issue

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Suggested Solutions

    Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
    In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now