|
Definitions More Info. | Definition ID | 786 | Title | SQL | Category | NOTES | Definition | SQL mail with HTML+CSS | Definition Description | USE [DBACHECKDB] GO /****** Object: StoredProcedure [dbo].[dba_spDBSizeSendMail] Script Date: 16.04.2019 15:20:28 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO
ALTER PROCEDURE [dbo].[dba_spDBSizeSendMail] @dbNameMail VARCHAR(100) OUTPUT AS -- Compose Mail DECLARE @IP VARCHAR(100) ,@svrName VARCHAR(255) ,@tableHTML NVARCHAR(MAX) ,@subject1 VARCHAR(200) ,@recipients CHAR(100) ,@subject CHAR(250) ,@body NVARCHAR(MAX)
-- Mail title and server name to print in mail content SELECT @IP= (SELECT TOP(1) local_net_address FROM sys.dm_exec_connections WHERE local_net_address IS NOT NULL) --SELECT @IP = '10.100.0.18'
SELECT @subject1=@IP+'_'+@@SERVERNAME+' '+@dbNameMail+' '+' DB SIZE CHANGED!!!' SELECT @tableHTML = N''+ N''+@IP+'_'+@@SERVERNAME+''+' '+@dbNameMail+' DB'+ N''+ N'ID | '+ N'DBSizesQueryRelationID | '+ N'Database_id | '+ N'DBName | '+ N'DBFileID | '+ N'DBFileName | '+ N'DBFilePath | '+ N'DBFileSizeMBefore | '+ N'DBFileSizeMBAfter | '+ N'DBLastIncreasedSizeMB | '+ N'DBFileSizeGBefore | '+ N'DBFileSizeGBAfter | '+ N'DBLastIncreasedSizeGB | '+ N'IsShrinked | '+ N'IsInitialSize | '+ N'IsMailed | '+ N'RecordDate | '+ CAST ( ( SELECT td = O.[ID], '', td = O.[DBSizesQueryRelationID], '', td = O.[Database_id], '', td = O.[DBName], '', td = O.[DBFileID], '', td = O.[DBFileName], '', td = O.[DBFilePath], '', td = O.[DBFileSizeMBefore], '', td = O.[DBFileSizeMBAfter], '', td = O.[DBLastIncreasedSizeMB], '', td = O.[DBFileSizeGBefore], '', td = O.[DBFileSizeGBAfter], '', td = O.[DBLastIncreasedSizeGB], '', td = O.[IsShrinked], '', td = O.[IsInitialSize], '', td = O.[IsMailed], '', td = O.[RecordDate], '' FROM DBACHECKDB.dbo.ufc_MaxIDForDbSizes(@dbNameMail) O ORDER BY O.DBFileID FOR XML PATH('tr'), TYPE) AS NVARCHAR(MAX)) + N' '+ N' '+ --N'
|
|
|
|
|
|