• Gianluca Sartori here on SSC posted the code below in another thread, and i really like how well it works. this might help you with what you were after...it pretty much only emails errors/issues.

    http://www.sqlservercentral.com/Forums/Topic1009121-146-1.aspx

    To get a notification, you can set up a job that runs the sp as query for a dbmail.

    --Proc from Gianluca Sartori @SSC

    --add to a job to send results of sp as mail

    --updated table definition based on real world experience from

    --Bliar (jbhauser @SSC)

    CREATE PROCEDURE [maint].[dba_runCHECKDB]

    @dbName sysname = NULL,

    @PHYSICAL_ONLY bit = 0,

    @allMessages bit = 0

    AS

    BEGIN

    IF OBJECT_ID('tempdb..#DBCC_OUTPUT') IS NOT NULL

    DROP TABLE #DBCC_OUTPUT

    CREATE TABLE #DBCC_OUTPUT(

    Error int NOT NULL,

    [Level] int NOT NULL,

    State int NOT NULL,

    MessageText nvarchar(256) NOT NULL,

    RepairLevel varchar(255) NULL,

    Status int NOT NULL,

    DbId int NOT NULL,

    ObjectId int NOT NULL,

    IndexId int NOT NULL,

    PartitionId bigint NOT NULL,

    AllocUnitId bigint NOT NULL,

    [File] int NOT NULL,

    Page int NOT NULL,

    Slot int NOT NULL,

    RefFile int NOT NULL,

    RefPage int NOT NULL,

    RefSlot int NOT NULL,

    Allocation int NOT NULL

    )

    DECLARE c_databases CURSOR LOCAL FAST_FORWARD

    FOR

    SELECT Name

    FROM master.sys.databases

    WHERE Name = ISNULL(@dbName, Name)

    OPEN c_databases

    FETCH NEXT FROM c_databases INTO @dbName

    WHILE @@FETCH_STATUS = 0

    BEGIN

    DECLARE @sql nvarchar(4000)

    SET @sql = 'DBCC CHECKDB('+ @dbName +') WITH TABLERESULTS, ALL_ERRORMSGS'

    IF @PHYSICAL_ONLY = 1

    SET @sql = @sql + ', PHYSICAL_ONLY '

    INSERT INTO #DBCC_OUTPUT

    EXEC(@sql)

    FETCH NEXT FROM c_databases INTO @dbName

    END

    CLOSE c_databases

    DEALLOCATE c_databases

    IF NOT EXISTS (

    SELECT 1 FROM #DBCC_OUTPUT

    )

    BEGIN

    RAISERROR('No database matches the name specified.',10,1)

    END

    SET @sql =

    'SELECT DB_NAME(DbId) AS DatabaseName, ' +

    CASE @allMessages

    WHEN 1 THEN '*'

    ELSE 'Outcome = CASE WHEN MessageText LIKE ''%0 allocation errors and 0 consistency errors%'' THEN 0 ELSE 1 END, MessageText '

    END + '

    FROM #DBCC_OUTPUT ' +

    CASE @allMessages WHEN 1 THEN '' ELSE 'WHERE Error = 8989' END

    EXEC(@sql)

    END

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!