Capturing Failed SQL statements

  • I'm probably not using the right search terms here since nothing came up regarding error trapping. The application I work on uses a function for executing against the database. Consequently when the logfiles only show the line number of the function where the sql is executed. This is maddening because I am unable to response.write the sql out or see where in the code it is! I'm using ASP and mostly stored procedures but also plenty of ad hoc queries (queries built on the codepage and sent to the DB (SQL Server 2K Enterprise). Is there a way for SQL server to log failed SQL or can you suggest a way I might log these from ASP?

    Thanks In Advance!

    Rich

  • This was removed by the editor as SPAM

  • Have you tried using SQL Profiler to capture and analyze your queries or stored procedures?

  • You should find many, many examples of Error Handling on this site.  You just need to remember to create a @Variable to capture @@Error, because you will immediately loose it upon the next process.  When I would do this in VB, we had numerous levels to capture errors and pass them.  I am not sure how to handle that in ASP. 

    Good hunting. 

    I wasn't born stupid - I had to study.

  • Thanks for the replies. I was hoping to avoid changing the stored procedures in an attempt to capture errors. There are some uses of @@ERROR but the coders only inquire about its length and do nothing with the content. While there are many Stored Procedures in use there are just as many, or more, queries executed from the codepage.

    I've been using Profiler as well but not so much in the production environment. It bloats quickly and the system is so poorly written it teeters easily.

    I'll keep poking around!

    Thanks again: Rich

Viewing 5 posts - 1 through 4 (of 4 total)

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