Execute an sp when due to a specific replication error_text message

  • Please help I want to be able to modify this query to return a value called 'pegasus' which will cause the @query i my (msdb.dbo.sp_send_dbmail) proc to execute;

    USE distribution

    GO

    SELECT ma.publisher_db,

    ma.publication,

    ma.subscriber_db,

    msre.time,

    msre.error_text

    FROM msrepl_errors msre

    INNER JOIN msdistribution_history msh

    ON ( msre.id = msh.error_id )

    INNER JOIN msdistribution_agents ma

    ON ( ma.id = msh.agent_id )

    WHERE publisher_db='TB60'

    AND error_text = (this should have a value CALLED Pegasus)

    BEGIN

    EXECUTE as login = 'sa'

    EXEC msdb.dbo.sp_send_dbmail

    @profile_name = 'TRXSQL04 Profile',

    @recipients = 'babu@triseptsolutions.com;',

    @query = 'EXEC [TRIxu_CER_AddSubscription-CERPlus_TRXSQL04_DAB_TABLES_TB60]',

    @execute_query_database ='TB60',

    @subject = 'Testing Replication',

    @body = 'Reported replication failures ',

    @attach_query_result_as_file = 0 ;

    END

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply