If you would like to query the ERRORLOG with T-SQL you have the undocumented procedure SP_READERRORLOG. But as it’s a procedure filteriung the result may be a bit hard.
By using a table variable it becomes much easier:
DECLARE @errorlog TABLE ( LogDate datetime, ProcessInfo varchar(max), LogText varchar(max) ) INSERT INTO @errorlog EXEC sp_readerrorlog SELECT * FROM @errorlog
Just add any where-clause and start finding the records you're interested in.