Home Forums SQL Server 7,2000 T-SQL Create a scheduled task to email from SQL RE: Create a scheduled task to email from SQL

  • Yeah I think i will stick to the xp_sendmail function for now as it seems to be a bit quicker and easier to use. Will defo read up on it tho.

    Cheers!!

    With the code below

    EXEC master.dbo.xp_sendmail

    @recipients = N'',

    @query = N'EXEC RPT_3_Daily ''21-oct-2008''',

    @subject = N'UK1428',

    @message = N'Please find new information attached.',

    @attach_results = 'TRUE',

    @width = 250,

    @separator = ',',

    @no_header = 'TRUE',

    @attachments = 'New.csv'

    the attachment I receive doesn't sit in the columns properly, I have opened the file up using notepad++ which displays a lot of "NULL" values when the stored procedure to be run contains characters as well as numerics in the results, however if I use the same code as above and use a stored procedure that will only produce numbers then the csv displays fine and even opens in excel, is there something else that I have missed off to allow the file produced display and organise the alphanumeric characters correctly within excel?