简体   繁体   English

每天将数据从一个数据库中的源表传输到另一个数据库中的目标表的最佳方法

[英]Best way to transfer data from source table in one db to destination table in another db daily

What would be the best way to transfer certain number of records daily from source to destination and then remove from source?每天将一定数量的记录从源传输到目的地然后从源中删除的最佳方法是什么?

DB - SQL server on cloud. DB - 云上的 SQL 服务器。

As the databases are in the same server, you can create a job that transfers the data do the other database.由于数据库位于同一台服务器中,您可以创建一个将数据传输到另一个数据库的作业。

在此处输入图像描述

Because the databases are in the same server you can easily access them, just by adding the database before the table in the query, look the test that i did:因为数据库位于同一台服务器中,您可以轻松访问它们,只需在查询中的表之前添加数据库,查看我所做的测试:

CREATE DATABASE [_Source]
CREATE DATABASE [_Destination]

CREATE TABLE [_Source].dbo.FromTable
(
some_data varchar(10)
)

CREATE TABLE [_Destination].dbo.ToTable
(
some_data varchar(10)
)

INSERT INTO [_Source].dbo.FromTable VALUES ('PAULO')

--THE JOB WOULD BE SOMETHING LIKE THIS:

-- INSERT INTO DESTINATION GETTING THE DATA FROM THE SOURCE
INSERT INTO [_Destination].dbo.ToTable
SELECT some_data 
FROM [_Source].dbo.FromTable

-- DELETE FROM SOURCE
DELETE [_Source].dbo.FromTable

暂无
暂无

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

相关问题 仅将更新的表数据从一个数据库复制到另一数据库 - Copy only updated table data from one DB to another DB 我正在尝试将数据从 Azure 数据库中的一个表迁移到另一个 AWS 数据库中的另一个表。 实现这一目标的最佳方法是什么? - I'm trying to migrate the data from a table in a Azure DB to another table in a different AWS DB. What is the best way to achieve this? 将数据从一个表转移到另一表 - Transfer data from one table to another table SSIS - ole db 源/目标 - 仅从源服务器检索行在表目标服务器中存在的位置 - SSIS - ole db source/destination - only retrieve rows from source server WHERE EXISTS in table destination server 将 sql 表同步到另一个 db sql 表的最佳方法? - Best way to synchronize sql table to another db sql table? 使用查询将数据从一个db的表复制到另一个db的表中(两个表具有相同的结构) - Copy data from table of one db into table of another db using query (both tables have same structure) 将表数据从一个数据库复制到具有条件的另一个数据库 - copy table data from one db to another with where condition 定制类sql查询类,用于将所选记录从一个db.table传输到另一个 - custom class sql query class to transfer selected record from one db.table to another 插入时将数据从一个表转移到另一个表 - Transfer data from one table to another on insert 使用python在另一个数据库上创建一个相似的表 - Create a similar table from one DB on another DB using python
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM