简体   繁体   English

将数据从一个数据库的一个表复制到另一数据库的另一个表

[英]Copy data from one table of one database to onother table of other database

Hello i know that are answers about my question but i cannot figure it out. 您好,我知道这是关于我的问题的答案,但我无法弄清楚。 So i need help. 所以我需要帮助。 I have to databases, Database A and B. 我要数据库A和B。

Database A has structure
table AT and columns 
A1
A2
A3
A4

Database B has structure
table BT and columns
B1
B2
B3
B4

how i can make the query to copy all the data from database B and table BT to database A and table AT? 我如何进行查询以将所有数据从数据库B和表BT复制到数据库A和表AT?

i now is something like 我现在有点像

select * into [databaseTo].dbo.tablename from [databaseFrom].dbo.tablename

but i don't know how to right it. 但我不知道如何纠正。 Thank you 谢谢

Then 然后

INSERT INTO A.AT (A1, A2, A3, A4)
SELECT B1, B2, B3, B4 
FROM B.BT

should do the work. 应该做的工作。 Your MySQL user needs privileges for both databases of course. 您的MySQL用户当然需要两个数据库都具有特权。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将数据从一个表复制到同一个数据库中的另一个表? - How to copy data from one table to other in same database? MySQL查询通过检查onother表中的其他两个属性从一个表中选择所有数据 - mysql query to select all data from one table by check the other two atributes in onother table 如何在MySQL中将表从一个数据库复制到另一个数据库 - How to copy table from one database to other database in mysql 将数据从一个数据库中的表复制到 wordpress 数据库 - Copy Data from a table in one Database to a wordpress database 每5秒将数据从一个表复制到另一个@mysql数据库 - copy data from one table to another @mysql database every 5 secs 将数据从一个数据库复制到同一个表中的另一个 - Copy Data From One Database To Another In Same Table PHP / MySQL:将表和数据从一个数据库复制到另一个数据库 - PHP/MySQL: Copy Table and Data from one Database to another 将所有数据从一个表传输到另一个相同的数据库 - Transfering all data from one table to the other same database 将2个表中的行从一个数据库复制到其他数据库中的1个表中,但在PHP中使用同一服务器 - Copy rows from 2 tables from one database to 1 table in other database but same server in PHP 如何仅将两个数据库数据内容表复制到一个表中 - how to copy two table of database data content into on one table only
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM