msdb.dbo.sp_send_dbmail SEND Binary Column But Auto Truncate

  • 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;

  • try to use @file_attachments.

    What is the size of the file. Default size is 1 MB. U need to change some conf settings if ur file size is > 1 MB.

    -Lucky

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply