SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 key violation
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

AskSQLTeam
Ask SQLTeam Question

USA
0 Posts

Posted - 01/08/2003 :  08:57:44  Show Profile  Visit AskSQLTeam's Homepage
Laurence writes "We have an application that queries a SQL 2000 (SP1) database. In general the application runs well, but occasionally a query is run that causes a Foreign Key violation.

I have tried using Profiler to capture these by adding Errors and Warnings fields to the Events and filtering for Error Equals 547. However this only captures an entry noting the error occurred, not the SQL that caused it. I know the name of the table affected, and that the query is an INSERT, but there are too many inserts to the table happening (that work) to capture
them all and scan them manually.

Any answer to the above much appreciated.

Laurence"

nr
SQLTeam MVY

United Kingdom
12543 Posts

Posted - 01/08/2003 :  10:25:34  Show Profile  Visit nr's Homepage
You can log the sql statements and errors to a table using the profiler then search for the error.
You might find this slows things down a lot though.

If the insert is done via a stored proc (and not errored in a trigger) then you could log info from the SP.
One of the reasons for using SPs for all database access.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000