RE: Naming a File and E-mailing Using DTS
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 @cmdshellset @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', […]
2004-03-17