HELP WITH STORED PROCEDURE

  • can someone help with a STORED PROCEDURE that reads the errorlog file and filter out the following key words:

    error, warn, kill, dead, cannot, could, fail, not, stop, terminate, bypass, roll, truncate, upgrade, victim, recover, IO requests taking longer than, dbcc

    🙂

  • If you had searched SSC for "import errorlog"

    you would have come to a lovely script "Deadlock Notifications in SQL Server 2005"

    by Patrick LeBlanc ( 2007/10/10 ) which could get you started ....

    http://www.sqlservercentral.com/articles/Administration/3243/

    SSC is a huge library .... use it 🙂

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • mak3 (9/22/2009)


    can someone help with a STORED PROCEDURE that reads the errorlog file and filter out the following key words:

    error, warn, kill, dead, cannot, could, fail, not, stop, terminate, bypass, roll, truncate, upgrade, victim, recover, IO requests taking longer than, dbcc

    🙂

    CREATE PROC [sp_readerrorlog](

    @p1 INT = 0,

    @p2 INT = NULL,

    @p3 VARCHAR(255) = NULL,

    @p4 VARCHAR(255) = NULL)

    AS

    BEGIN

    IF (NOT IS_SRVROLEMEMBER(N'securityadmin') = 1)

    BEGIN

    RAISERROR(15003,-1,-1, N'securityadmin')

    RETURN (1)

    END

    IF (@p2 IS NULL)

    EXEC sys.xp_readerrorlog @p1

    ELSE

    EXEC sys.xp_readerrorlog @p1,@p2,@p3,@p4

    END

    run:

    exec sp_readerrorlog 6,1,'stop' to see all error WITH the word "stop" in it, withtrace ID = 1.

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    This thing is addressing problems that dont exist. Its solution-ism at its worst. We are dumbing down machines that are inherently superior. - Gilfoyle

  • hope it helps, i know it is not ideal.

    play with it.

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    This thing is addressing problems that dont exist. Its solution-ism at its worst. We are dumbing down machines that are inherently superior. - Gilfoyle

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply