그것은 OutputDB
에 target
테이블 설치 1. 3 가지 방법
을 사용하여 달성 한 후 updated
가지고 또는 inserted
는 간단한 쿼리를 작성하여 얻을 수있는 행을 같은 Create
및 modified TimeStamp
등 TimeStamp
열이 될 수있다. execte sql task
에 Control Flow
~ delete
의 행을 넣고이 행을 Sync
테이블에 써야합니다.
Delete from SyncTable
where keyColumn in (Select primary_key from target
where ModifiedTimeStamp >= GETDATE() or (ModifiedTimeStamp is null
and CreateTimeStamp>=GETDATE()))
나는
StudentsA's
primary key
이
Target
테이블의
primary key
과 함께
Sync
테이블에 존재하는 가정합니다.
new row
이 값이
updated
있는 경우
TimeStamp
열이있는 경우 다음
modifiedTimeStamp
가 위의 쿼리가 작동 현재 날짜
있을 것이다 added
다음 CreateTimeStamp
열 current
날짜를하고 modifiedTimeStamp
다른 null
될 것 인 경우 위의 조건은 기본적으로 확인 내가 Data Warehouse
2.You에 당신의 데이터를로드 업데이트를 수행 할 MERGE
구문을 사용하고 Execute SQL Task
- 안돼과 Control Flow
에 삽입를 사용해야 할 경우가있을한다고 생각하여 target
테이블에.당신이 어떤 TimeStamp columns
DECLARE @Output TABLE (ActionType VARCHAR(20), SourcePrimaryKey INT)
MERGE StudentsB AS TARGET
USING StudentsA AS SOURCE
ON (TARGET.CommonColumn = SOURCE.CommonColumn)
WHEN MATCHED
THEN
UPDATE SET TARGET.column = SOURCE.Column,TARGET.ModifiedTimeStamp=GETDATE()
WHEN NOT MATCHED BY TARGET THEN
INSERT (col1,col2,Col3)
VALUES (SOURCE.col1, SOURCE.col2, SOURCE.Col3)
OUTPUT $action,
INSERTED.PrimaryKey AS SourcePrimaryKey INTO @Output
Delete from SyncTable
where PrimaryKey in (Select SourcePrimaryKey from @Output
where ActionType ='INSERT' or ActionType='UPDATE')
내가 시간이 나누었다에서 - 적어도 그 진행 방법 당신에게 공정한 아이디어를 줄 것이다 실행 해요로 코드는 테스트되지 않은이없는 경우 아래의 쿼리도 사용할 수 있습니다 . .FOR MERGE
더 furthur 구문에 대한 세부 Insert
this 및 this
3.Use Multicast
부품 duplicate
에 데이터 집합을 판독 Update
.Connect MULTICAST
lookmatch
출력과 Lookup No match output
제 3의 해결책이 제 문제에 가장 적합합니다. 나는 처음 2 개가 다른 서버에서 DB를 사용한다고 생각하지 않는다. – JackoBongo