GibboK
GibboK

Reputation: 73938

DataBase Referential integrity your opinion on Log Table

I use MS SQL 2008 and C#.

I need design a system able to Log CRUD operations on a specif table.

In my example I have two Tables:

Articles with PK ArticleId

and

LogArticles with a FK to ArticleId.

LogArticles is suppose to record any CRUD operations for my Articles table (the actual code reside in my BL no SQL).

I understand abit about Reference Integrity and I'm concern what is the best approach in case I delete a record from Articles and denying or losing of reference in `LogArticles.

Here my Ideas:

Please tell me what do you think about it, or any your expeirce if you have build a similar system before. Thanks for your time.

Upvotes: 0

Views: 77

Answers (1)

Randy
Randy

Reputation: 16677

if i understand you question:

keep the structure as you described, then add a trigger on Article to post the event to LogArticles with the current key.

Upvotes: 1

Related Questions