DECLARE @tableHTML NVARCHAR(MAX) ; SET @tableHTML = N'
213.243.1.227 ARION DATABASE KOTA UYARILARI
' + N'
' + N'
Database_Adı
Su_Andaki_Boyutu
'+ N'
Verilen_Kota
'+ N'
Kota_Doluluk_Oranı
'+ CAST ( ( select td = [name],'', td = (CAST(CAST(((size * 8.00)/1024.00) AS DECIMAL(18,2)) as varchar)) +' '+'MB', '', td = (CAST(CAST(((max_size * 8.00)/1024.00) AS DECIMAL(18,2))as varchar)) +' '+'MB', '', td = '%'+(CAST(CAST(((size * 100)/max_size) AS DECIMAL(18,2))as varchar)) , '' FROM sys.master_files a (nolock) WHERE max_size <> '-1' and ( name <> 'FileStreamDocuments' and name <> 'sysft_Full-Text Search Catalog' ) and size >= ( select (cast(max_size as bigint) *80)/100 as sizen from sys.master_files b where max_size <> '-1' and a.database_id = b.database_id and a.file_id = b.file_id ) FOR XML PATH('tr'), TYPE) AS NVARCHAR(MAX) ) + N'
'+ N' '+ N'
' + N'
213.243.1.227 ARION DATABASE KOTA UYARISI!!!
'; --query sonucunu mail atan bölüm --?ayet olu?turulan tablo ile a?a??daki ko?ul sa?lanm?yorsa mail atm?yor select top 1 * from sys.master_files a WHERE max_size <> '-1' and ( name <> 'FileStreamDocuments' and name <> 'sysft_Full-Text Search Catalog' ) and size >= ( select (cast(max_size as bigint) *80)/100 as sizen from sys.master_files b where max_size <> '-1' and a.database_id = b.database_id and a.file_id = b.file_id ) if @@rowcount > 0 begin EXEC msdb.dbo.sp_send_dbmail --@recipients='[email protected]', @recipients='[email protected]', @subject = '172.21.1.5 DATABASE KOTA UYARISI !!!', @body = @tableHTML, @body_format = 'HTML'; End