Logging Foreign Key violations

  • Hi guys,

    I have a DB running against SQL 2008 r2, that today we discovered - by accident - has been encountering Foreign Key Violations on a frequent basis. The Web site that accesses the DB just ignores the error, and completes it's task(s) as if nothing wrong had occurred.

    I've been trying to find a way of tracking the fact a FK violation has occurred and logging this somewhere, so we can revisit the Web code and 'fix' it.

    I had this vague recollection there was a trace flag that did this, but apparently not. I've looked into creating a trace [via Profiler], but can't find the event/message that would be raised by a Foreign Key violation.

    Has anyone got some useful thoughts on how I may be able to log the errors so I can identify the scale of the issue and then start about getting our Web code fixed?

    Thanks for your time

  • enable logging for the error numbers so it's written to the sql error log.

    [font="Comic Sans MS"]The GrumpyOldDBA[/font]
    www.grumpyolddba.co.uk
    http://sqlblogcasts.com/blogs/grumpyolddba/

  • Please check for the triggers.

    Thanks

  • forsqlserver (5/18/2011)


    Please check for the triggers.

    How could that possibly help? There's an error and dml level, the trigger won't even get raised!

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

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