Questions tagged «acid»


1
使用触发器进行同步
我的要求与之前的讨论类似: 编写一个简单的银行架构:如何使我的余额与他们的交易记录保持同步? 结合交易触发 我有两个表,[Account].[Balance]和[Transaction].[Amount]: CREATE TABLE Account ( AccountID INT , Balance MONEY ); CREATE TABLE Transaction ( TransactionID INT , AccountID INT , Amount MONEY ); 当对该[Transaction]表进行插入,更新或删除时,[Account].[Balance]应基于进行更新[Amount]。 目前,我有一个触发器可以完成此任务: ALTER TRIGGER [dbo].[TransactionChanged] ON [dbo].[Transaction] AFTER INSERT, UPDATE, DELETE AS BEGIN IF EXISTS (select 1 from [Deleted]) OR EXISTS (select 1 …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.