Results 1 to 2 of 2

Thread: sp_send_dbmail

  1. #1
    Join Date
    Sep 2004
    Posts
    10

    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

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •