Why get tables cleaned and copied in an SQL-Server DB?



  • 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



  • You can find if there's a job that refers to a specific table using https://social.msdn.microsoft.com/Forums/sqlserver/en-US/023cb795-41f5-40b0-af3c-0fae0d6ced5a/sql-query-to-find-tables-used-in-sql-jobs?forum=transactsql :

    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.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2