Scan error log

  • I am trying to get errors along with error codes,  looks like some of the error messages does not match with error code

    use tempdb
    CREATE TABLE errors
    (
        RowID int IDENTITY PRIMARY KEY,
        EntryTime datetime,
        source varchar(50),
        LogEntry varchar(4000)
    )

    insert into errors
    exec master..sp_readerrorlog 0

    select a.*,b.* from errors a, errors b where a.logentry like 'Error:%' and b.rowid=(a.rowid - 1) order by a.entrytime desc

  • Try joining on  b.rowid=(a.rowid + 1)

    John

  • thanks, it works

    select a.*,b.* from errors a, errors b where a.logentry like 'Error:%' and b.rowid=(a.rowid + 1) order by a.entrytime desc

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

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