February 20, 2018 at 9:13 am
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
February 20, 2018 at 9:19 am
Try joining on b.rowid=(a.rowid + 1)
John
February 20, 2018 at 9:28 am
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 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy