sp_send_dbmail error

  • I'm getting following error when trying to use @Query parameter in sp_send_dbmail:

    ================================================

    Msg 14661, Level 16, State 1, Procedure sp_send_dbmail, Line 476

    Query execution failed: Error initializing COM

    Msg 0, Level 11, State 0, Line 0

    A severe error occurred on the current command. The results, if any, should

    be discarded.

    =====================================================

    Following is my query:

    exec msdb.dbo.sp_send_dbmail

    @profile_name='remotesmtp'

    ,@recipients='xxxxx@xxxxxxxx.com'

    ,@body='test'

    ,@query='select top 5 * from dbname.dbo.setup'

    ,@copy_recipients='zzzz@zzzzzzzzz.com'

    ,@subject='test'

  • Hi AJ,

    Please can you confirm that you have enabled Database Mail OK and that it is JUST the @QUERY parameter that is throwing things out for you?

    Do other sp_send_dbmail queries work?

  • Yes, it's only the @QUERY parameter that is throwing things out for me. No other sp_send_dbmail queries work.

    Also, I forgot to add that it does work 1 out of 10 times if I keep trying.

    Things seem to have stabilized after I disabled OLE Automation using SQL2005 Surface area configuration. But this means I can't use sp_OACreate function.

  • I have the same error when I add an attachment.

    Something seems to be known by Microsoft. See http://support.microsoft.com/kb/910416


    Kindest Regards,

    erde

  • Hi ,

    Do you have SP1 installed on the server? I am getting the error on the servers which are  without any service pack. I'll apply SP2 and try.

  • I ran into the same issue, but had my network/security folks to uppade MDTCluster Firewalls-rule to allow the server and thus database_mail access to the smtp server.

  • I have the same issue with SQL Server 2005 with SP2 and all available post-SP2 hotfixes, i.e. build 3159.

    The solution suggested by "A J" - disable OLE Automation - fixed the problem.

    My messages looked like:

    Msg 22050, Level 16, State 1, Line 0

    Error formatting query, probably invalid parameters

    Msg 14661, Level 16, State 1, Procedure sp_send_dbmail, Line 495

    Query execution failed: Error Intiailizing COM . CoInitialize failed with Hresult: 0x80010106


    Best Regards,
    Jiri Kvarda

  • I was running into this on SQL 2005 SP2 and found the following, which states that Microsoft is not intending on fixing this issue:

    http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=361954

Viewing 8 posts - 1 through 7 (of 7 total)

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