I am wondering if is there a way to make a table writable only by an specific trigger in SQL Server or Oracle DB. Just to make an example:
Table: "Operation" ID | Date | Account1_ID | Account2_ID | Amount Table: "Transactions" ID | Date | Account | Debt | CreditWhat I want to ensure is that the Transactions table only receive data from a trigger in the Operation table.
Is there a way to achieve that?
Execute As allows you to create a trigger that runs as a user different to the current user. So you can create a separate user who has write access to your TRANSACTIONS table, and execute the trigger as that user.
If no other users have write access, only the trigger user can modify the data.
Of course you then need to make sure nobody can log in as that user, and that you can trust your DBA to manage the account.