August 28, 2013 at 12:12 pm
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
August 28, 2013 at 12:13 pm
Great catch. Thanks
Joe
August 28, 2013 at 4:27 pm
Very good catch! 🙂
August 28, 2013 at 8:14 pm
Joe, I am thinking of officially adding this to the script. Would you be okay with that?
August 29, 2013 at 6:06 am
Sure I would be honored.
August 29, 2013 at 4:45 pm
Great! Thank you so much. 🙂
August 29, 2013 at 4:46 pm
Cool! Can't wait for the next version!
SQL Padre
aka Robert M Bishop
"Do or do not, there is no try" -- Yoda
September 5, 2013 at 9:10 am
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)
September 11, 2013 at 9:17 am
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).
September 11, 2013 at 2:51 pm
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.
September 11, 2013 at 3:09 pm
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'
September 11, 2013 at 5:12 pm
Nice catch! Thank you! I will review and add it to the next update. 🙂
September 12, 2013 at 9:27 am
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.
September 12, 2013 at 9:38 am
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.
September 12, 2013 at 10:00 am
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