Infor ERP LN的数据表里的两个隐藏字段:T$REFCNTD和T$REFCNTU

拿Item General Data的Table – tcibd001举例,如果你在数据库里直接查询,你会看到两个字段:T$REFCNTD和T$REFCNTU,图示如下:

但是,如果从LN里面的ttaad4500看表结构,你是看不到的。

这两个字段有什么用呢?

refcntd – Referential Control Delete Mode
refcntu – Referential Control Update Mode

字段Refcntd存储一条记录的删除约束的数量
字段Refcntu存储一条记录的更新约束的数量。
只要通过Tools模块新增的表,这两个字段会自动添加到每个Baan/LN表中,您不必手动添加它们。

以下来自官方的介绍:

To guarantee referential integrity, the Baan/LN Database stores reference counters, which indicate how many times a record is used in a parent child relation. Since baan/LN can store each data in a several different database, we can not use the referential integrity mechanisms of the database itself. The field Refcntd stores the number of delete constraints to a record, the Refcntu stores the number of update constraints to a record. These fields are automatically added to each Baan table so you do not have to add them manually.

Only if the reference counter is zero, can the parent record be deleted.
Reference counters are only applicable if the Referential Control Delete Mode (refcntd) or Referential Control Update Mode (refcntu) in the relation is “Restricted (with counter)”.

为什么要说这个呢

重点来了,有时候,你需要从外部程序往Baan/LN的表写记录,那么就得考虑给这两个字段赋值的问题了。

别忘了在你的语句中增加这两个字段,比如:(T$REFCNTD,T$REFCNTU) VALUES (0,0)

至于为啥赋值为零,我这个新表其实没啥关联的表,那么都默认为0了。

好了,春节将至,特以此文收官祝广大Infor ERP LN/Baan战友们2021牛年大吉大利、身体健康、万事如意!