SQL Server System Report

  • Joe, Great addition! I would make one small change though.

    If NO errors or failures are found then @vXML_String is NULL. When @vXML_String is appended to @vBody then the whole thing becomes NULL and the email sent is blank. I would add something like:

    IF NOT EXISTS (SELECT * FROM @vErrorLogs)

    BEGIN

    GOTO Skip_ErrorLog

    END

    Lee

  • Great catch. Thanks

    Joe

  • Very good catch! 🙂

  • Joe, I am thinking of officially adding this to the script. Would you be okay with that?

  • Sure I would be honored.

  • Great! Thank you so much. 🙂

  • Cool! Can't wait for the next version!

    SQL Padre
    aka Robert M Bishop

    "Do or do not, there is no try" -- Yoda

  • FYI, For me to get Joes ErrorLogReporting section incorporated and compiled on 2005 I had to change the 2 declare statements to be:

    DECLARE @vTodaysDate VARCHAR(20); set @vTodaysDate = CONVERT(VARCHAR(20), GETDATE(),100)

    DECLARE @vYesterdaysDate VARCHAR(20); set @vYesterdaysDate = CONVERT(VARCHAR(20), GETDATE()-1,100)

  • Joes ErrorLogReporting code uses SP xp_readerrorlog. If you cycle your SQL Server error log daily be sure to schedule your report BEFORE you cycle your error log because the code specifies to use the current error log (0 = current log file).

  • chumphrey 12211 (9/11/2013)


    Joes ErrorLogReporting code uses SP xp_readerrorlog. If you cycle your SQL Server error log daily be sure to schedule your report BEFORE you cycle your error log because the code specifies to use the current error log (0 = current log file).

    Yeah that part would be determined by each environment.

    Thank you for pointing it out as others may not be aware of it.

  • I found a bug where the job scheduler piece was picking up disabled schedules for the Next Run Date / Time column. I added this line to address it:

    INNER JOIN msdb.dbo.sysschedules SS ON SJS.schedule_id = SS.schedule_id

    AND SS.[enabled] = '1'

  • Nice catch! Thank you! I will review and add it to the next update. 🙂

  • There is also an "enable" field in the msdb.dbo.sysjobs table. From the looks of it this shows if the job is enabled as whole, while your code shows if the schedule is enabled... In cases where there are multiple schedules this could get tricky. Will need to check both.

  • Good idea, that is true. I was focused on the scheduled piece since I had multiple schedules but only 1 enabled. Nice script, very useful.

  • Thank you! A lot of changes are coming in the next version BTW. 🙂

Viewing 15 posts - 106 through 120 (of 189 total)

You must be logged in to reply to this topic. Login to reply