Sql表的关系? [英] Sql Table Relations ?

查看:84
本文介绍了Sql表的关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

有两个表分别名为myTable(id,name,description,type)和myTable2(id,name).
当我将记录添加到myTable2时,我希望sql也将新记录添加到表myTable中.为此,我该如何关联这两个表.

感谢您的提前答复..

Hi all,

There are two tables which named myTable(id,name,description,type) and myTable2(id,name).
When I add a record to myTable2, I want sql add the new record to table myTable also. How can I relate these two table for this purpose.

Thanks for the replies in advance..

推荐答案

使用Trigger

看到这个

http://www.datasprings.com/resources/articles-信息/creating-email-triggers-in-sql-server-2005 [ http://www.go4expert.com/forums/showthread.php?t=15510 [ ^ ]
use Trigger

see this

http://www.datasprings.com/resources/articles-information/creating-email-triggers-in-sql-server-2005[^]

http://www.go4expert.com/forums/showthread.php?t=15510[^]


INSERT INTO myTable (id,name)
SELECT id,name
FROM myTable2


这篇关于Sql表的关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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