programmer
programmer

Reputation: 83

How to Create a single Trigger on multiple Database Tables

I have a database which contains some tables such as article, news, projects,...

I want to save a record to another table (Activity) when a record inserted into each table in database without activity

I don't want to create a trigger for each table.

How can I do it?

Upvotes: 1

Views: 310

Answers (1)

Neil N
Neil N

Reputation: 25258

If you were to use an intermediate layer, such as an ORM like Entity Framework, you could, in effect, have a "database wide" trigger, by overriding the OnSaveChanges event to add a log record anytime something is committed to the database.

My answer on This Question does exactly that

Upvotes: 1

Related Questions