SQL SERVER sent an error message to send SQL results via job. (Error 22050)

Source: Internet
Author: User

Environment: SQL SERVER2008R2

Symptom Description:

In the job, do the following: The error of this report is executed as the user NT authority\network SERVICE.  Error formatting query, probably invalid parameters [SQLSTATE 42000] (Error 22050). The step failed.

But the direct execution in the SSMs client is normal to send ...

Exec
Dbo.sp_send_dbmail
@profile_name = ' mail server ',
@recipients = ' recipient ',
@subject = ' message header ',
@body = ' body ',
@query = ' select * FROM table '

Very strange, do a lot of tests to find out which part of the problem, the process is not much to repeat, directly say my solution.

The problem with the database version is finally suspected. The existing version is:

Microsoft SQL Server R2 (RTM)-10.50.1600.1 (X64)
APR 2 2010 15:48:46
Copyright (c) Microsoft Corporation
Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601:service Pack 1) (Hypervisor)

Find a test machine to hit the SP1 patch to do the test:

Microsoft SQL Server R2 (SP1)-10.50.2500.0 (X64)
June 17 2011 00:54:03
Copyright (c) Microsoft Corporation
Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601:service Pack 1) (Hypervisor)

In the job, you can finally send the message normally.

Of course there may be a better solution and no patching required. Please advise me of your knowledge.

SQL SERVER sent an error message to send SQL results via job. (Error 22050)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.