I use sp_send_dbmail
to generate and send files that are fed to other program. The program digests "ANSI/ASCII" and "ISO-8859-1" encoding. But I can't get sp_send_dbmail
to make one.
Procedure call looks like this
exec msdb.dbo.sp_send_dbmail
@profile_name= @profile_name,
@recipients = @recipients,
@body = @body,
@subject = @subject,
@attach_query_result_as_file = 1,
@query_result_header = 0,
@query_result_no_padding = 1,
@query = @query,
@query_attachment_filename = @fname,
@query_result_width = 4000,
@mailitem_id = @mailitem_id OUTPUT
So the attachment is created from results of passed query. But the resulting file that is actually attached to mail for some reason is encoded with UCS2 Little Endian. Is there a way to change it?