August 11, 2022 at 1:51 pm
Hi,
Trying to Create a query that will execute on the current database and return information needed for purge logic.
Columns are:
1) Table and Schema name
2) Priority (int) by increments of 1000 starting at 100,000
3) Foreign key name
4) Related table name
5) Has DVD (Is there a field with the word "DVD" in the name. )
6) Has EmpId (Is there a field called Emp_id or EmpId, employee_id or employeeid)
7) Has Partner (Is there a field with the word "partner" in the name)
8) Excluded (a table that not specific to a partner, company or employee is excluded)
Priority should look something like this (within each priority group sort by table name):
1) Foreign key dependencies (child tables on top, parent tables on bottom)
2) Tables with an EmpId
3) Tables without a EmpId but have an DVD
4) Tables with partner
5) All others
Notes:
1) System tables should be excluded from this list. Only user tables.
2) Tables without a relationship add 500,000 to priority so we have room to add more tables with foreign keys
3) Since Excluded table are not going to be updated add 1,000,000 to the priority so we have room to add more tables.
The goal is to give highest priority to most dependent tables so that we can delete information in a proper order.
Any suggestions please.
Thank you!
August 11, 2022 at 6:02 pm
You have all the suggestions written out in your post. Just code to those. Like Granny used to say, "You can only peel one potato at a time". Pick a task from the list and write code to solve it.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply