Can we attach log files / any files in mail for SQL server agent jobs mail notification? can we configure it in database mail configuration?

sai satish 20 Reputation points
2023-11-03T07:55:08.2433333+00:00

After completion of a SQL server agent job running a report will be logged in SQL server, but in notification mail only with some specific details mail will be sent to required participants so I am having a doubt on attaching log file in that mail notification to verify the complete log details of a job. Please let me know anyone as I am new to SQL server agent jobs configuration.

Azure SQL Database
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,826 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,578 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,639 questions
0 comments No comments
{count} votes

Accepted answer
  1. LiHongMSFT-4306 27,026 Reputation points
    2023-11-03T08:14:16.6033333+00:00

    Hi @sai satish
    Try sp_send_dbmail in the msdb database.

    [ @file_attachments = ] N'file_attachments'

    A semicolon-delimited list of file names to attach to the e-mail message. Files in the list must be specified as absolute paths. The attachments list is of type nvarchar(max).

    By default, Database Mail limits file attachments to 1 MB per file.

    Before use, Database Mail must be enabled using the Database Mail Configuration Wizard, or sp_configure.

    Best regards,

    Cosmog Hong


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.