I'm working on an SQL-Server database.
Regularly, entries from one table get moved to another one (from entries
to Log_Entries
) in order not to flood the database. (The Log_Entries
get cleaned afterwards too)
I would like to know how this works, but I don't find any corresponding entry in the "Stored Procedures" or "Functions" and there seem not to be any "Database Triggers". Also the "Rules" part of the database seems to be empty.
Which entry in the database can be responsible for such a task?
Edit after first comment
I have "Database Diagrams", "Tables", "Views, "External Resources", "Programmability", "Service Broker", "Storage" and "Security".
Within "Programmability" there are "Stored Procedures", "Functions", "Database Triggers", "Assemblies", "Types", "Rules", "Defaults" and "Sequences".
Where is that SQL Agent?
Thanks in advance
1 Answer 1
You can find if there's a job that refers to a specific table using this query:
SELECT j.name,
s.database_name,
s.command
FROM msdb.dbo.sysjobsteps s
INNER JOIN msdb.dbo.sysjobs j
ON s.job_id = j.job_id
WHERE s.command LIKE '%TableName%'
AND s.database_name LIKE '%DatabaseName%';
It's not 100% safe method though as your job might refer to a stored procedure which refers to the table. Yet, I recommend using it since you could be lucky enough to find the job you're looking for and save time going through each job manually.
-
It's a good attempt, but I didn't find what I was looking for (there were only some "purge" related jobs).Dominique– Dominique2022年03月17日 12:56:18 +00:00Commented Mar 17, 2022 at 12:56
-
SQLAgentUserRole
granted.