Home Which Job inserted this record / row into the table?
Reply: 1

Which Job inserted this record / row into the table?

nr-91 Published in 2017-12-05 23:50:01Z

I have dozens of different SQL Jobs calling different Sprocs, which insert rows into a common table.

Is there any way, given a row in the table, to retrieve the job which triggered the insert?

Input: Row ID, TableName, DBName

Output: Job ID which inserted Row

Dan Farrell
Dan Farrell Reply to 2017-12-05 23:55:02Z

Not generally, as far as I'm aware. You could have the insert query include that data. Or you could get it from a log, maybe based on the primary key or another unique key, if your inserts are unique. You might be able to turn on some SQL server equivalent of the general log; but that's devastating to high volume performance and you'd still have to pull it from a log file. I recommend you consider whether you can diagnose your components from their logs in addition to their effects in the database.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.303582 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO