If I want to delete 1 person in "AdventureWorks2017" data base, for example:
DELETE FROM [Person].[Person] WHERE BusinessEntityID = 1
I know I have to make sure that all dependencies to that person are removed before I can do it.
Because Person.Person
has many dependencies and may have 7 levels of dependencies (like for [Sales].[SalesOrderHeaderSalesReason]
), what would be the best way to do it?
How do i write the db script to delete it and all that person’s dependencies.