Case Environment:
Operating system: Windows 2003 SE 32bit (SP2)
Database version: Microsoft SQL Server 2005-9.00.5069.00 (Intel X86)
22 2012 16:01:52
Copyright (c) 1988-2005 Microsoft Corporation
Standard Edition on Windows NT 5.2 (Build 3790:service Pack 2)
Case Analysis:
As shown below, when you send a message using the following SQL statement, you encounter a very strange error message: Not enough storage are available to complete this operation
EXEC ' [email protected] ',
' It's only Test ' NULL ' text ',
'---',
' SELECT * from MESDB.dbo.MES_DAILY_CLOSING_LOG ';
MSG 22050, Level A, State 1, line 22
Error formatting query, probably invalid parameters
MSG 14661, Level A, State 1, Procedure sp_send_dbmail, line 517
Query execution failed:Sqlcmd:Error:Internal Error at Getdatarowset (Reason:not enough storage are available to Complet e this operation).
Sqlcmd:Error:Internal Error at Formatrowset (Reason:not enough storage was available to complete this operation).
Error Although prompted storage not engough, in fact, this error and storage has no relationship, the table mes_daily_closing_log inside there are three fields nvarchar (MAX), take the following two ways to temporarily solve the problem.
1: If the three nvarchar (MAX) fields are excluded from @query, the message is sent normally without any errors.
2: If the field is converted in @query, such as cast (mail_receips as NVARCHAR (4000)), then the mail will be sent normally.
This issue does not occur under SQL Server 2008, SQL Server 2012, and in addition to the SQL Server 2005 (9.00.5000.00) version. Only this server will be error, later in this Sp_help_jobsteplog fails when run as a @query of the sp_send_dbmail of the text , after restarting the database service, There will be no such problem. Waiting for a week to wait until a suitable time to restart the server, verify that after the restart, the error has disappeared. There is very little information about this error on the web, and serious suspicion is that a bug has been triggered.
Resources:
Https://social.msdn.microsoft.com/Forums/en-US/0882f984-58f4-4a2a-8d0c-5f2c1e3cc853/msdbdbospsenddbmail-error? Forum=transactsql
Http://dba.stackexchange.com/questions/3591/sp-help-jobsteplog-fails-when-run-as-a-query-of-sp-send-dbmail
SQL Server 2005 sp_send_dbmail appears internal error at Formatrowset (Reason:not enough storage was available to complete this O Peration)