Search SQL Error Log

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

    Alejandro Pelc

  • 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?

  • 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

  • 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

  • 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

  • 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]

  • Thanks for the info

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

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