Search SQL Error Log

  • Ale Pelc

    SSCrazy

    Points: 2421

    Comments posted to this topic are about the item Search SQL Error Log

    Alejandro Pelc

  • Nancy Georgitsis

    Newbie

    Points: 9

    I am a newbie to sql.

    I can get this to work on sql 2005 but not on sql 2000? How can I make it work for sql 2000?

  • Ale Pelc

    SSCrazy

    Points: 2421

    Hi Nancy,

    sorry the delay but I'm on a trip and just saw your post. First of all, it won't work on SQL 2000 because I create a table variable, which is not supported. Second, the sp_readerrorlog procedure exists on SQL 2000, but the parameters are not the same. I'll try to get my hands in one SQL 2000 instance tomorrow and then post back the sp.

    Thanks,

    Alejandro

    Alejandro Pelc

  • James Morrison

    SSC-Addicted

    Points: 405

    Hi there,

    I receive this error when I test your script with the following parameters

    sp_SearchSQLErrorLog @AllLogs = 0, @LogFile = 1, @SearchString1 = 'login', @SearchString2 = 'sa'

    RegQueryValueEx() returned error 2, 'The system cannot find the file specified.'

    Msg 50000, Level 11, State 3, Procedure sp_SearchSQLErrorLog, Line 63

  • Ale Pelc

    SSCrazy

    Points: 2421

    Hi James,

    That means that one of the log files is not there. I'll review the script to validate that the log file exists.

    Cheers,

    Alejandro

    Alejandro Pelc

  • Robert Davis

    One Orange Chip

    Points: 28027

    There is an easier way to do this. Just use xp_enumerrorlogs.

    See my blog post on the subject: Error Logs: Part Two

    Also see Error Logs: Part I which also shows you how to do it in SQL 2000.


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

  • James Morrison

    SSC-Addicted

    Points: 405

    Thanks for the info

Viewing 7 posts - 1 through 7 (of 7 total)

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