当前位置:Gxlcms > 数据库问题 > SQL Server 2005 sp_send_dbmail出现Internal error at FormatRowset (Reason: Not enough storage is available to complete this operation)

SQL Server 2005 sp_send_dbmail出现Internal error at FormatRowset (Reason: Not enough storage is available to complete this operation)

时间:2021-07-01 10:21:17 帮助过:19人阅读

msdb.dbo.sp_send_dbmail @recipients = ‘konglb@xxx.com‘,
     @subject = ‘it is only test‘, @body = NULL, @body_format = ‘text‘,
     @query_result_separator = ‘---‘,
     @query = ‘SELECT * FROM  MESDB.dbo.MES_DAILY_CLOSING_LOG‘;

 

Msg 22050, Level 16, State 1, Line 22

Error formatting query, probably invalid parameters

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

Query execution failed: Sqlcmd: Error: Internal error at GetDataRowset (Reason: Not enough storage is available to complete this operation).

Sqlcmd: Error: Internal error at FormatRowset (Reason: Not enough storage is available to complete this operation).

 

技术分享

 

错误虽然提示storage not engough,其实这个错误跟存储没有任何关系,这个表MES_DAILY_CLOSING_LOG里面有三个字段为NVARCHAR(MAX),采取下面两种方式可以临时解决这个问题。

 

1: 如果在@query里面排除这三个NVARCHAR(MAX)字段,那么邮件正常发送,不会出现任何错误。

2: 如果在@query里面将这个字段做一下转换,例如CAST(MAIL_RECEIPS AS NVARCHAR(4000)),那么邮件也能正常发送。

 

在SQL Server 2008、 SQL Server 2012下都不会发生,另外在SQL Server 2005(9.00.5000.00)这个版本下测试,也没有出现这个问题。只有这台服务器会出错,后面在这篇sp_help_jobsteplog fails when run as a @query of sp_send_dbmail章里面反馈,重启数据库服务后,就不会出现这个问题。等了一周等到一个合适的时机重启了服务器,验证发现重启过后,果然这个错误就消失了。网上关于这个错误的资料非常少,严重怀疑是触发了某一个Bug。

 

参考资料:

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出现Internal error at FormatRowset (Reason: Not enough storage is available to complete this operation)

标签:strong   cti   get   padding   his   测试   subject   server   sep   

人气教程排行