Hi all,
I use DatabaseMail for sending a file attachment,
but when i select binary type,the file auto truncate.
Query: SELECT 0xA52972BC684B24AB17AAB435643D
File Attachment Content:
0xA52972BC684B24AB17AA
(1 rows affected)
Script:
DECLARE @Date char(10),@Subject nvarchar(255),@FileName nvarchar(255);
SET @Date = CONVERT(char(10),GETDATE()-1,121);
SET @Subject = N'test - '+ @Date;
SET @FileName = 'test_'+@Date+'.txt';
EXEC msdb.dbo.sp_send_dbmail
@recipients = 'test@test.com',
@query = 'SELECT 0xA52972BC684B24AB17AAB435643D
' ,
@subject = @Subject,
@attach_query_result_as_file = 1,
@query_result_header = 0,
@query_attachment_filename = @FileName,
@execute_query_database = 'test',
@query_result_width = 32767 ,
@query_no_truncate = 1,
@exclude_query_output = 0;