-
sp_send_dbmail
I have a maintenance plan which put out a report everyday after if runs, with the name as PlainMMDDYYYY. Using sp_send_dbmail, how can one have the report sent to the operator when the new file each day? I have at the end of the plan an Excute T-SQL Statement task which exec sp_db_mail but using the @file_attachment won't get the newly name file each day :cool:
-
You can write T-SQL script to get file name, try using xp_cmdshell 'dir /b' to get the name. Use INSERT statement to put the output of xp_cmdshell into a table then you can use that to generate @file_attachment.