Azure - Could not find stored procedure 'sp_send_dbmail'

  • Environment: Azure - Microsoft SQL Server Management Studio -14.0.17277.0
    Question: I have the query ready which will run the report for every few minutes however it throws error ‘Could not find stored procedure 'sp_send_dbmail' error
    Looks like Azure does not have msdb and needs to be configured differently. Please help!!
    Code: 
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER procedure [Reporting].[sp_vCServerStatus]
    as
    select
        *
    from
        reporting.vCServerStatus
    where
        [Time Since Last Check] > 10
    If @@ROWCOUNT > 0
    EXEC msdb..sp_send_dbmail ----- this is were I am getting the error. 
      @profile_name = 'Profile_one',
     @recipients = 'Sample'
     @importance = 'low',
    else
      end
    GO

  • sizal0234 - Monday, September 24, 2018 11:05 AM

    Environment: Azure - Microsoft SQL Server Management Studio -14.0.17277.0
    Question: I have the query ready which will run the report for every few minutes however it throws error ‘Could not find stored procedure 'sp_send_dbmail' error
    Looks like Azure does not have msdb and needs to be configured differently. Please help!!
    Code: 
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER procedure [Reporting].[sp_vCServerStatus]
    as
    select
        *
    from
        reporting.vCServerStatus
    where
        [Time Since Last Check] > 10
    If @@ROWCOUNT > 0
    EXEC msdb..sp_send_dbmail ----- this is were I am getting the error. 
      @profile_name = 'Profile_one',
     @recipients = 'Sample'
     @importance = 'low',
    else
      end
    GO

    sp_send_dbmail isn't supported on Azure- except with managed instances. This article has a possible work around:
    Database Mail on SQL Azure

    Sue

Viewing 2 posts - 1 through 1 (of 1 total)

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