如何一次将值存储到两个表中 [英] how to store value into two tables at a time

查看:88
本文介绍了如何一次将值存储到两个表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我可以一次将一个值分成两个表吗?

例如:

我有男性和女性单选按钮..
当我单击女性时,该值应同时存储在两个表即tfn和支付表中

解决方案

选中此

如何在两个中存储相同的值表格? [ ^ ]


您的问题尚不清楚,但我想向您发出警告:不要将相同的值存储在两个表中,最终会导致数据不一致.而是使用一个专用表存储数据并在其他表中引用.



您可以在此处使用触发器.................

1)在表tfn中写入触发器...
1)一旦将其插入到表tfn中.......触发器将被执行,并且您可以将该值从tfn插入到另一个表中.

有关触发器,请参考此内容
触发器-SQL Server [ 解决方案

Check this

how to store a same values in two tables?[^]


Your question is unclear, but the way it is I''d give you a warning: don''t store the same value in two tables, it''ll eventually lead to inconsistent data. Instead, use one dedicated table to store data and reference it in other tables.


Hi,
You Can Use trigger here .................

1)write trigger in table tfn...
1)once you insert into table tfn.......trigger will get executed and and you can insert that value from tfn to another table.

Refer this for Triggers
Triggers -- Sql Server[^]


这篇关于如何一次将值存储到两个表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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