Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004
    Posts
    191

    Unanswered: generate a email using smtp server (was "Help with query....")

    Help with query: I currently cannot be alerted by SQL Mail so I would like to take the script that was generated by SQL server and using the store procedure sp_sqlsmtpmail to generate a email using smtp server to alert me. The store procedure does work. I would like to know if this is possible.

    Thanks

    Lystra


    -- Script generated on 1/21/2005 10:04 AM
    -- By: MAMSI\sa
    -- Server: (local)

    IF (EXISTS (SELECT name FROM msdb.dbo.sysalerts WHERE name = N'Demo: Full tempdb'))
    ---- Delete the alert with the same name.
    EXECUTE msdb.dbo.sp_delete_alert @name = N'Demo: Full tempdb'
    BEGIN
    EXECUTE msdb.dbo.sp_add_alert @name = N'Demo: Full tempdb', @message_id = 9002, @severity = 0, @enabled = 1, @delay_between_responses = 10, @include_event_description_in = 5, @database_name = N'tempdb', @category_name = N'[Uncategorized]'

    Then

    Exec sp_sqlsmtpmail
    @vcTo = 'lwilliams@Huc.com',
    @vcBody ='Check out problem Immediataly.',
    @vcSubject ='DOCSITE01FDK - Full Tempdb Log'

    END

  2. #2
    Join Date
    Dec 2004
    Location
    CA, USA
    Posts
    63
    You can have the alert execute a job that has the call to sp_sqlsmtpmail in one of it's steps.

  3. #3
    Join Date
    Jul 2004
    Posts
    191
    Great idea, thanks.

    Lystra

Posting Permissions

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