Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to access the ErrorLog remotely

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-11-26 : 08:40:41
Amy writes "How to access to a database's Errorlog from an ASP application?
It's a SQL Server 2000 database, Enterprise Edtion. What I need to do is generateing a report whenever there is an error occured in the DB. But I need to get the info from the web application. First of all, is the ErrorLog the right replace to check for errors? Does anybody have a sample code? What privilage I need to have?

Any help would be highly appreciated!!

Many thanks in advance!!
Amy"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-11-26 : 08:43:25
There is an undocumented system procedure called sp_readerrorlog. You can get the current error log with this:

EXECUTE master..sp_readerrorlog

If you want the previous error log:

EXECUTE master..sp_readerrorlog 1

And the one before that:

EXECUTE master..sp_readerrorlog 2

...and so on. I know there's another way of doing it that might be the documented method, but I can't find it right now. Be wary of undocumented procedures, they may change or disappear with future releases.

Go to Top of Page
   

- Advertisement -