在删除触发器之前从表中删除记录 [英] Delete Records from Table Before Delete Trigger

查看:231
本文介绍了在删除触发器之前从表中删除记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在MSSQL中,当您将触发器加载到表上时,您可以访问要对其进行操作(更新,插入,删除)的记录的缓存表".

I know that in MSSQL when you load a trigger onto a table, that you have access to a "cache table" of the record(s) to be operated on (Update, Insert, Delete).

是否可以使用Access中的类似机制?如果不是,如果我想从基本表到联接表强制执行1:1-M,我该怎么做?

Is there a similar mechanism to utilize from Access? If not, if i want to enforce a 1:1-M from a base table to the Join Tables, how would i do this?

尝试使用他们的哦,如此有用"的关系模式,但是由于我无法找到PK的i设置并建立索引的唯一"索引,因此我无法使用Enforce Integrity的逐滴删除部分.看到罕见"的关系状态对我来说很常见,这对我来说似乎很常见.

Tried using their "Oh so useful" Relationship Schema, but since i cant find a "unique" index for the PK's i setup and indexed, i cant use the trickle-down delete portion of the Enforce Integrity. Has the "rarely" seen, which seems to be common for me, Relationship status of "Indeterminate".

  • gid
  • nm
  • (更多字段)
  • gid + nm(唯一标识-gid不是自动编号)
  • gid
  • gid
  • cid
  • (更多字段)
  • gid + cid(唯一标识)
  • gid
  • cid
  1. 如果(删除了table1.gid),则Delete * From Table2 Where gid=delete.id
    • 其中delete是缓存表
  1. If (table1.gid is deleted) then Delete * From Table2 Where gid=delete.id
    • Where delete is the cache table

编辑2012-09-04 @ 12:20 pm

好吧,这是我现在拥有的Data-Macro,它的语法可能很草率,但是到目前为止,我从在线阅读中得出的结论都是如此.使用这种格式时,我有什么要注意或期望的吗?是的,deletegroup是在模块中发布的globabl方法.

Edit 2012-09-04 @ 12:20pm

Ok Here is the Data-Macro i have right now, its probably syntactically sloppy but what i have deduced so far from my readings online. Is there anything i should be aware of, or expect, when using this format? And yes deletegroup is a globabl method posted in a Module.

最终用户将使用Runtime Access,运行环境与完整版是否应以某种方式阻止此触发器?

The end-users will be using Runtime Access, should this trigger be hampered in any way by a runtime environment vs a full-version?

推荐答案

宏的自然下一步就是为业务提供模型 规则.数据宏允许开发人员将逻辑附加到记录/表 事件(类似于SQL触发器).这意味着您可以合而为一地编写逻辑 位置,更新这些表的所有表单和代码都将继承该表 逻辑.以下是您在典型情况下可能会发现的一些数据宏方案 捐赠管理数据库:

The natural next step in macros is to provide a model for business rules. Data macros allow developers to attach logic to record/table events (similar to SQL triggers). This means you write logic in one place and all forms and code that updates those tables inherit that logic. Here are a few data macro scenarios you might find in a typical Donations Management database:

访问2010数据宏(类似于触发器)

或者,对于层叠删除,请考虑根据我对上一篇文章的评论建立关系:

Alternatively, for cascade delete, considering setting up relationships as per my comment to your previous post: Reference to composite primary key in Access 2007

这篇关于在删除触发器之前从表中删除记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆