将主表值移动到详细信息 [英] Move master table value to detail

查看:108
本文介绍了将主表值移动到详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我有一个表table1,并创建了table1的详细信息表,我想将主表的字段值移动到详细信息表而不需要手动操作(大约700条记录),有没有办法通过sql或vb .net?

主表id(PK),名称,carnum,地址,ssn,ead,sub(整数想要移动值到细节)每个主记录的字段)

详细表id(PK),id_2(FK),年份,子(在此字段中我想移动每个主记录的sub值),receip_num

解决方案

使用光标 [ ^ ]到移动/更新从一张桌子到另一张桌子的记录。



如何在Sql中使用Cursor [ ^ ]


你可以在主表插入动作上使用触发器。

Hello,
I have a table, table1, and created a detail table of table1, I want to move the value of a field of the master table to the detail table without do it manually (about 700 records), is there any way through sql or vb .net?
master table id (PK), name, carnum, address, ssn, ead, sub (integer want to move value to detail field for each master record)
detail table id (PK), id_2 (FK), year, sub (in this field I want to move the value of sub for each master record), receip_num

解决方案

Use Cursor[^] to move/Update the records from one table to the other.

How to use Cursor in Sql[^]


u can use trigger on master table inserted action.


这篇关于将主表值移动到详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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