2

So I got a list of jobs in my server and 2 tables that one of those jobs is aggregating. Lets say in table "A" there is a rows of purchase receipts, and in table "B" its info that is used by other procedures lets say purchase price/VAT/etc.. So my question is there a way to find which jobs uses that table or both of them? FYI I am using SQL server 2008 R2

  • A job can invoke anything that can invoke other stuff, etc. This makes it difficult to debug. On the other hand, you can add a trigger to the tables that record every access with data like `CONTEXT_INFO()` or `ORIGNIAL_LOGIN()`. – Tamas Rev Mar 27 '18 at 15:47

1 Answers1

2

You can use the table that stored SQL Agent job steps, but that only helps if each step makes a call directly to the table and doesn't just call a stored proc:

select * from msdb.dbo.sysjobsteps where command like '%my_table%'

Tingo
  • 472
  • 7
  • 11
  • And there are no functions, views or anything else that might hide the table usage. But this works great if all the sql is inline. – Sean Lange Mar 27 '18 at 15:40