How to Specify Which Font When xp_sendmail Generates Report

  • hi all,

    I'm using the following SQL stmt to generate a text file which gets emailed to recipients as an attachment.

    The problem is that the text file is in the Lucida Console font and users see "garbage" when they open the attachment.

    The server does have other fonts installed - how can I force xp_sendmail to use a different font for the text file it creates?

    Thanks very much!

    John

    EXEC xp_sendmail @recipients = 'jbates@nowhere.com;mmcknatt@nowhere.com',

       @query = 'Select [Dlr Num] AS [Dealers in Fund Transactions But Not on Dealer Names]

    From gm.dbo.[Fund Transactions]

    Where not exists (Select * from gm.dbo.[Dealer Names and Addresses] Where gm.dbo.[Dealer Names and Addresses].[Dlr Num] = gm.dbo.[Fund Transactions].[Dlr Num])

    Group by [Dlr Num];

    Select [Dlr Num] AS [Dealers in Branch But Not on Dealer Names]

    From gm.dbo.Branch

    Where not exists (Select * from gm.dbo.[Dealer Names and Addresses] Where gm.dbo.[Dealer Names and Addresses].[Dlr Num] = gm.dbo.[Branch].[Dlr Num])

    Group by [Dlr Num];Select [Dlr Num] AS [Dealers in Claims But Not on Dealer Names]

    From gm.dbo.Claims

    Where not exists (Select * from gm.dbo.[Dealer Names and Addresses] Where gm.dbo.[Dealer Names and Addresses].[Dlr Num] = gm.dbo.[Claims].[Dlr Num])

    Group by [Dlr Num]',

    @attachments = 'GM Dealer Numbers Cross-Checked.txt',

    @subject = 'GM Dealer Numbers Crossed-Checked',

    @message = 'The Dealer Number Comparison listing is attached:',

    @attach_results = 'TRUE', @width = 80

    GO

  • Text files are font-less. The font is a setting of the text editor that you are using to open the file, so you are barking up the wrong tree here. I don't know for sure, I suspect that your problem is locality based. What is the server collation for your SQL instance? What is the data type of the various DlrNum columns? Are the columns of the same collation as the server default? Just how trashy is the "garbage"; do you see clear text interspersed with junk, or is it completely unreadable? What is the editor that users are using? Notepad? (Notepad defaults to Lucida Console, at least on my XP box.)

  • skeane, Thank you for replying.

    Turns out, you are correct. This isn't a font issue at all.

    I had to visit the user's PC and change the File Association for .TXT files to Open With Notepad, not Word.  Now when they click the attached text file it opens in Notepad and the report is readable.

    Thanks for getting me on the right track.

    John

     

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

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