数据建模更新子表 [英] Data modeling update child tables

查看:76
本文介绍了数据建模更新子表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含4个表的数据库
表1有1列汽车
表2有2列汽车,类型
表3具有3列的汽车,类型,所有者
Table4具有4列car,type,owner,reg
我想在表1中更改表2 3和4的car列的值,并在表2中更改表3和4时更改类型的列的值
并在表3中更改所有者表时更改表4中所有者列的值,当我为汽车创建新条目时,希望在下面的所有表中创建该所有者

I have a data base with 4 tables
Table1 has 1 column car
Table2 has 2 columns car,type
Table3 has 3 columns car,type,owner
Table4 has 4 columns car,type,owner,reg
I want to change the value of car column for table 2 3 and 4 when it changes in table 1 and change the value of type column in table 3 and 4 when it changes in table 2
and change the value of owner column in table 4 when it changes in table 3 same when i create a new entry for car I want it to be created in all the below tables

推荐答案

你好,

您可以在代码中触发之后创建.

在SQL触发器上查看 MSDN文章 [
Hi,

You can create after trigger in your code.

Check MSDN Article on SQL Trigger[^]

Trigger will update your corresponding table if the table is updated.

So, you need to create After update trigger on Table1, Table2, Table3.

It will works for you


这篇关于数据建模更新子表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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