tracking sql errors

  • I know i can add a trace flag to allow me to track and resolve deadlocks however i have a site who is running entity framework and it's doing three separate inserts. One of em is failing due to truncation issues. We've got the front end notifying us when it occurs however i dont get the actual column its failing on. Is there a way i can force all sql errors to the log?

  • would they be on the app logs on the sql box perhaps?

  • By default those types of errors do not go to the SQL Server Error Log or anywhere else except back to the client. You could setup an Alert to let you know when one of these types of errors occurred. Do you know the error number? How to: Create an Alert Using an Error Number (SQL Server Management Studio) - SQL Server 2005. An alert will let you know it happened, but in order to find out the SQL statement that caused it, seeing as you're on SQL 2005, you would need to run a Trace to capture information. In the Trace I would capture SQL:StmtStarting, SQL:StmtCompleted, SP:Starting, SP:Completed, User Error Message and Exception events with columns SPID, TextData, EventSequence, ObjectName, & LoginName. Not all columns will pertain to all events. Setup smart filters to ignore data you are not interested in. An obligatory word of caution: on a busy system Trace can capture a lot of data and in some cases adversely affect system performance so only capture the events and columns you need and watch it closely to ensure you are not affecting overall performance.

    Server-Side Tracing and Collection

    The article shows how to use Profiler to create a trace definition, and then export it, but make sure you do that and write your trace to a file on the server, i.e. do not use Profiler to watch the activity, only to create the trace definition and script it.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • that stinks. i'm scared to run a trace for an extended period of time too. The issue doesn't happen every day.

    Oh well. Thanks.

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

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