如何在同时连接在一起的两个表中插入数据 [英] How Do I Insert Data In Two Tables At The Same Time Which Are Connected Together

查看:71
本文介绍了如何在同时连接在一起的两个表中插入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将如何在表中插入数据,其中我插入数据的数据将被插入到系统中记录相同数据的另一个表中。

解决方案

?没有这样的东西。



你必须将你的数据插入到Person表中,取回它所分配的ID,然后在第二次插入地址时使用它带有剩余数据的表。


正如Dave说的那样,没有什么比自动更好的了,你可以使用存储过程来执行任务并维护可以使用的ACID属性存储过程中的事务


How will i insert data in the table , where data that i'am inserting it will be inserted in the other table in the system which are recording the same data .

解决方案

Automatically? There's no such thing.

You have to insert your data into the Person table, get back the ID it was assigned, then use that in a second Insert into the Address table with the remaining data.


as Dave say's there is nothing like Automatically
you can use stored procedure to perform your task and to maintain ACID property you can use transaction in stored procedure


这篇关于如何在同时连接在一起的两个表中插入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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