Hi Craig,
Most people fall for the fact that they try to log and then undo those deletions, but the logs get undone as well. Make sure you’re pushing the deleted virtual table details into a table variable within the trigger, then after rolling back, write it out from the table variable (which won’t have rolled back) But if you’re not rolling it back, why isn’t it logging in the trigger? Or does the trigger not have access to what you need? Other option (depending upon version, edition, etc.) is to set up a database audit specification. Final option is to leave an extended events session running, that looks for that occurrence. Regards, Greg Dr Greg Low 1300SQLSQL (1300 775 775) office | +61 419201410 mobile│ +61 3 8676 4913 fax SQL Down Under | Web: <https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.sqldownunder.com%2F&data=02%7C01%7Csspahelp%40microsoft.com%7C1f0ea4d6b97e4d897f3708d666d1e890%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636809449091516274&sdata=SLHeEGAMmWUY5YIwcC4oAPYr%2F9RIZdi4MNASsdzwX2I%3D&reserved=0> www.sqldownunder.com | <https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgreglow.me%2F&data=02%7C01%7Csspahelp%40microsoft.com%7C1f0ea4d6b97e4d897f3708d666d1e890%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636809449091526278&sdata=IU8tnAITCjBxWafi3A9XpO9lF3PIwZJ8ad3t36lnxvs%3D&reserved=0> http://greglow.me From: [email protected] <[email protected]> On Behalf Of David Gardiner Sent: Monday, 29 April 2019 4:13 PM To: ozDotNet <[email protected]> Subject: Re: Finding DB change source If you don't mind if things break a little, change your triggers to do a RAISERROR and then wait to see what falls over. Probably best done in a non-production environment :-) On Mon, 29 Apr 2019 at 15:21, Craig vN <[email protected] <mailto:[email protected]> > wrote: I have an unusual problem, there is a field in my DB (SQL Azure) that is being changed but I can't work out where it is being changed from. I have created some DB triggers so I can log changes and see exactly when it changes but can't find the source. Is there anything I can set up in code at a DB level so when the field changes I can log and hopefully get a call stack? The data access is primarily through NHibernate and I have set up events in there to trap that changes but it doesn't get shown, so it is either ourside of NH or somewhere else, which is why I want to monitor at DB level. Craig
