是否可以同时在两个表中插入细节? [英] is it possible to insert details into two tables at the same time?
本文介绍了是否可以同时在两个表中插入细节?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以同时在两个表中插入细节?
i有两个名为registration的表和student_details我在两个表中都有几个相同的列表。所以我想在两个表中同时插入细节。当用户同时在注册表中输入详细信息时,应在student_details表中填写相同的列
帮助我谢谢
is it is it possible to insert details into two tables at the same time?
i have two tables called registration and student_details i have a few same columns in both tables. so i want to insert the details at the same time in two tables. when user enters details into the registration table at the sametime same columns should be filled in student_details table
Help me thanks
推荐答案
解决这个问题的最佳方法是创建一个存储过程,它将所有细节作为参数,并使用事务来确保两个更新都完成,或者两者都没有。
如果你看看这里: http://www.4guysfromrolla.com/webtech/080305-1.shtml [ ^ ]举例说明,但使用删除而不是插入,但原则完全相同。
The best way to approach this would be to create a stored procedure which takes all the details as parameters, and uses a Transaction to ensure that either both updates are done, or neither of them.
If you have a look here: http://www.4guysfromrolla.com/webtech/080305-1.shtml[^] it gives an example, but using deletes instead of inserts, but the principle is exactly the same.
这篇关于是否可以同时在两个表中插入细节?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文