Take a "slice" of a SQL Server database: for all tables, get only the rows that join (directly or indirectly) to a specific row
0
votes
1
answer
843
views
For audit purposes, I'm trying to obtain a copy/export of a DB but including only the rows from each table that have relevance to a small collection of rows in some table. So every row of every table that these rows point to; every row of every table that points to these rows; and so forth. (In algebra terms this is the transitive-symmetric-reflexive closure of those rows with respect to the foreign key relation.)
I'm wondering if there exists some kind of tool to do this, or if this is scriptable somehow. I have ~400 tables with a tight network of foreign keys so I'd rather not do this by hand.
Asked by Carl Patenaude Poulin
(115 rep)
Apr 8, 2021, 02:40 PM
Last activity: Apr 8, 2021, 05:02 PM
Last activity: Apr 8, 2021, 05:02 PM