xp_sendmail -- how do you set the text qualifier

  • Is there a way to set the text qualifier when sending a file via xp_sendmail?

    Thanks,

  • I use xp_sendmail to send my DBCC results to me every night, in my case the message has no @message contents. If your text has single quotes, I would assume just escape them.

    This is what I do:

    exec xp_sendmail

    @recipients = 'wwest@mydomain.org',

    @subject = 'DBCC Results',

    @attachments = 'd:\dbccs\dbcc_results.txt'

    -----
    [font="Arial"]Knowledge is of two kinds. We know a subject ourselves or we know where we can find information upon it. --Samuel Johnson[/font]

  • Thanks Wayne this wasn't exactly what I was looking for but your suggestion sparked another thought in my head and that was to use a delimiter other than a comma.  My case I used a * which seem to resolve the issue of my file actually having a comma in the data which caused confusion for files like MS Access attempting to import my text file.  i.e.

    declare @name varchar(50)

    set @name = 'My_File.txt'

    EXEC master..xp_sendmail

    @recipients = 'mark.fyffe@bell.ca',

    @query = 'select * from mydatabase.dbo.mytable',

    @message = 'my file ready',

    @subject = 'My File Delivered',

    @attachments = @name,

    @attach_results = 'TRUE',

    @width = 2000,

    @separator = '*'

  • Glad I could at least help indirectly. One of the best things about having peers (such as this forum) is that you can bounce ideas and it might inspire a solution even if it doesn't deliver one directly.

    -----
    [font="Arial"]Knowledge is of two kinds. We know a subject ourselves or we know where we can find information upon it. --Samuel Johnson[/font]

Viewing 4 posts - 1 through 3 (of 3 total)

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