• Try this one:

    declare @outfile varchar(255)

    declare @cmdshell varchar(255)

    declare @msgsubject varchar(255)

    set @outfile = 'd:\path\QryResult_' + convert(varchar(6), getdate(), 12) + '.asc'

    set @cmdshell = 'rename d:\path\yourfile.asc ' + @outfile

    exec xp_cmdshell @cmdshell

    set @msgsubject = 'This is the Query result for ' + convert(varchar(10), Getdate() , 102)

    exec xp_sendmail @recipients = 'a@company.com; b@company.com',

         @copy_recipients = 'c@company.com',

         @query = 'select GetDate()',

         @subject = @msgsubject,

         @attachments = @outfile,

         @attach_results = 'false'

    Matthias