INSERT server1_tbl SELECT * FROM server2_tbl [英] INSERT server1_tbl SELECT * FROM server2_tbl

查看:87
本文介绍了INSERT server1_tbl SELECT * FROM server2_tbl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我想知道如何从一张桌子到另一张桌子创建数据副本。



我试过这段代码但是没有用



Hello,

I would like to know how to create a copy of data from one table going to another table.

I tried this code but does not work

SELECT * INTO s_tbl1 IN 'server=localhost;User Id=root;password=password;Persist Security Info=True;database=test' FROM s_tbl2







谢谢




Thanks

推荐答案

基本上,您必须在要从中复制数据的主表上写入触发器。当主表中插入新记录时,此触发器应通过复制插入的行数据在第二个表中插入新记录。



点击此链接如何创建触发器:触发器 - Sql Server [ ^ ]
Basically you have to write a trigger on your main table from which you want to copy the data. This trigger should insert a new record in your second table by copying the inserted row data, whenever there is insert of new record happens in the main table.

Follow this link on how to create triggers: Triggers -- Sql Server[^]


这篇关于INSERT server1_tbl SELECT * FROM server2_tbl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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