How to virtually delete data from multiple tables that are linked by a foreign key ?
- by Shantanu Gupta
I am using Sql Server 2005
This is a part of my database diagram. I want to perform deletion on my database which will start from tblDomain up tp tblSubTopics.
Consider that each table has IsDeleted column which has to be marked true if request was made to delete data. But that data shoud remain their physically.
Tables which will have IsDeleted Column are
tblDomain
tblSubject
tblTopic
tblSubTopic
Now I want, if a user marks one domain as deleted then all the refrence field should also get marked as deleted. i.e.
1 domain is related to 5 subjects, those 5 subjects are related to 25 topics, those 25 topics are related to 500 subtopics and so on.
Then how should i mark all these fileds as Deleted. ?