Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2001
    Posts
    24

    Unanswered: Problem with package creation

    Hello,

    I am creating a package and I have a problem with it. I want to execute a sql task that checks if there are some records with some specifications available in my table. That's very easy to do. After this step I want to send a mail message to the user, but only if there are some records available. If there aren't, it may not send a mail.
    The result of the SQL task is always successfull (if there are some records or not), so I can't use the 'On Success'-workflow for it. Can you tell me how to do it, or is there another alternative for doing it?
    Thx for helping me out.

    Tom

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Have the sql task execute a stored procedure that handles the logic to email or not to email (using xp_sendmail) -- that is the question :-)
    Last edited by rnealejr; 03-07-02 at 13:31.

  3. #3
    Join Date
    Dec 2001
    Location
    Toronto, Canada
    Posts
    335
    Use RASIERROR within your SQL Task

    Code:
    IF NOT EXISTS (SELECT * FROM myTable)
        RAISERROR('',16,1)
    If there are no records a RAISERROR will be done and therefore the "On Failure" will be performed.

  4. #4
    Join Date
    Dec 2001
    Posts
    24
    Thx for the solution achorozy!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •