|
Definitions More Info. | Definition ID | 745 | Title | SQL | Category | NOTES | Definition | DBA_TryCatchErrorLogController | Definition Description | USE [DBACHECKDB] GO /****** Object: StoredProcedure [dbo].[DBA_TryCatchErrorLogController] Script Date: 24.06.2016 11:34:01 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[DBA_TryCatchErrorLogController] AS BEGIN DECLARE @IP VARCHAR(100), @svrName VARCHAR(255), @sql VARCHAR(400), @tableHTML NVARCHAR(MAX), @subject1 VARCHAR(200), @recipients CHAR(100), @subject CHAR(250), @body CHAR (250) --by default it will take the current server name, we can then set the server name as well SET @svrName = @@SERVERNAME -- Mail Konusunu Set etme SELECT @IP= (SELECT TOP(1) local_net_address FROM sys.dm_exec_connections WHERE local_net_address IS NOT NULL) SELECT @subject1=@IP+'_'+@svrName+' SQL WARNING!!!' BEGIN SELECT @tableHTML = N''+@IP+'_'+@svrName+' TRANSACTION WARNINGS!!!' + N'' + N'DBAtblTryCatchID | '+ N'ErrorNumber | '+ N'ErrorSeverity | '+ N'ErrorState | '+ N'ErrorProcedure | '+ N'SPName | '+ N'ErrorLine | '+ N'ErrorMessage | '+ N'LogDate | '+ CAST ( ( SELECT td = [DBAtblTryCatchID], '', td = [ErrorNumber], '', td = [ErrorSeverity], '', td = [ErrorState], '', td = [ErrorProcedure], '', td = [SPName], '', td = [ErrorLine], '', td = [ErrorMessage], '', td = [LogDate], '' FROM [DBACHECKDB].[dbo].[DBATryCatchErrorLog] WHERE IsMailed = 0 ORDER BY [DBAtblTryCatchID] DESC FOR XML PATH('tr'), TYPE) AS NVARCHAR(MAX)) + N'
---|
'+ N' '+ N'
|
|
|
|
|
|