我在將信息從一個表插入到其他表時存在一個小問題。刪除插入後存在的重複條目
例如:從table A
(可包含〜10個KK條目)table B
,表是相同的,除了table A
具有DateTimeStamp
其用於採取某些數據(邊界)。
所以我需要將數據從A移動到B(無DateTimeStamp
)和來自枯草
實施例刪除重複:
表A
DateTimeStamp | Key | value
2012-02-03 | 2 | 123
2012-02-03 | 3 | 985
2012-02-03 | 5 | 1584
表B
Key | value
8 | 45
3 | 785
9 | 7457
所以我需要刪除Key = 3
從Table B
行並插入Table A
其他所有內容。
結果將是:
Key | value
8 | 45
3 | 985
9 | 7457
2 | 123
5 | 1584
有優雅的方式來做到這一點?觸發器速度太慢,我正在尋找不需要臨時表的解決方案。
SQL Server或SSIS解決方案\建議,歡迎
哪個版本** ** SQL Server的oledbdestination? 2008年將有'MERGE'命令,這將是完美的這種情況下 –
2008年,感謝您的建議,我會嘗試與MERGE –
行 - 請參閱我的迴應MERGE語句的示例 –