sp_send_dbmail附件编码 [英] sp_send_dbmail attachment encoding
本文介绍了sp_send_dbmail附件编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在SQL2005中使用sp_send_dbmail发送带有结果的电子邮件作为附件.发送附件后,它是经过UCS-2编码的,我希望它是ANSI或UTF-8.
I am using sp_send_dbmail in SQL2005 to send an email with the results in an attachment. When the attachment is sent it is UCS-2 Encoded, I want it to be ANSI or UTF-8.
这是SQL
EXEC msdb.dbo.sp_send_dbmail
@recipients = 'temp@example.com'
, @query = 'DECLARE @string_to_trim varchar(60);SET @string_to_trim = ''1234''; select rtrim(@string_to_trim), ''tom'''
, @query_result_header=0
, @subject = 'see attach'
, @body= 'temp body'
, @profile_name= N'wksql01tAdmin'
, @body_format = 'HTML'
,@query_result_separator = ','
,@query_attachment_filename = 'results.csv'
,@query_no_truncate = '0'
,@attach_query_result_as_file = 1
我在网上看到一些评论,指出sql2005 SP2已解决此问题,但事实并非如此.
I have seen some comments on the internet that this is fixed with sql2005 SP2, but do not find it to be the case.
推荐答案
我认为解决唯一问题的唯一方法是使用BCP将数据转储到平面文件中,然后附加该文件.抱歉,我帮不上什么忙. :(
I think the only way to get around what you are seeing is to use BCP to dump the data to a flat file and then attach that file. Sorry I couldn't be more help. :(
这篇关于sp_send_dbmail附件编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文