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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
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  

Ask SQLTeam Question

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.



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.07 seconds. Powered By: Snitz Forums 2000