﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / T-SQL (SS2K8)  / Email Alert for VLF_count &amp;gt; 50? / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sun, 26 May 2013 03:38:17 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Email Alert for VLF_count &amp;gt; 50?</title><link>http://www.sqlservercentral.com/Forums/Topic1419824-392-1.aspx</link><description>Why can't you just change your IF statement?</description><pubDate>Thu, 14 Feb 2013 09:22:59 GMT</pubDate><dc:creator>Brandie Tarvin</dc:creator></item><item><title>Email Alert for VLF_count &amp;gt; 50?</title><link>http://www.sqlservercentral.com/Forums/Topic1419824-392-1.aspx</link><description>Hi,I have modified this script for getting email alert just VLF count information, also working fine and received email..I want to setting and receive alert when VLF count &amp;gt; 50 reached, could anyone modify this script as per requirement.[code="sql"]Create Table #stage(    FileID      int  , FileSize    bigint  , StartOffset bigint  , FSeqNo      bigint  , [Status]    bigint  , Parity      bigint  , CreateLSN   numeric(38)); Create Table #results(    Database_Name   sysname  , VLF_count       int ); Exec sp_msforeachdb N'Use ?;             Insert Into #stage             Exec sp_executeSQL N''DBCC LogInfo(?)'';              Insert Into #results             Select DB_Name(), Count(*)             From #stage;              Truncate Table #stage;' declare @VLFcount float  select @VLFcount=VLF_Count from #results    if (@VLFcount &amp;lt; 50)begin	declare @strsubject varchar(100)	select @strsubject='Check VLF_Count usage on ' + @@SERVERNAME	declare @tableHTML  nvarchar(max);	set @tableHTML =		N'&amp;lt;H1&amp;gt;VLF Information - ' + @@SERVERNAME +'&amp;lt;/H1&amp;gt;' +		N'&amp;lt;table border="1"&amp;gt;' +		N'&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Database_Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;VLF_Count MB&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;' +		--N'&amp;lt;th&amp;gt;% Memory Free&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;' +		CAST ( ( SELECT td = [Database_Name], '',	                    td = [VLF_Count], ''	                    FROM #results				  FOR XML PATH('tr'), TYPE 		) AS NVARCHAR(MAX) ) +		N'&amp;lt;/table&amp;gt;' ;	EXEC msdb.dbo.sp_send_dbmail	@from_address='test@test.com',	@recipients='test@test.com',	@subject = @strsubject,	@body = @tableHTML,	@body_format = 'HTML' ,	@profile_name='dbmail'endDrop Table #stage;Drop Table #results; [/code]rgdsananda</description><pubDate>Wed, 13 Feb 2013 23:39:21 GMT</pubDate><dc:creator>ananda.murugesan</dc:creator></item></channel></rss>