1. SQLSERVERæå¡å¨ä¸é¢å®è£
oracle客æ·ç«¯ï¼é
ç½®æå¡å½å(å设为 test)
2. å¨SQLSERVERæå¡å¨ä¸é¢å»ºç«é¾æ¥æå¡å¨ï¼èæ¬å¦ä¸
SQL code?
SQL code-- Adding linked server:
exec sp_addlinkedserver @server = 'test' ,
@srvproduct = 'ORACLE',
@provider = 'MSDAORA',
@datasrc = 'test'
-- Adding linked server login:
exec sp_addlinkedsrvlogin @useself='false ', @rmtsrvname = 'test',
@rmtuser = 'user', --æ°æ®åºç¨æ·
@rmtpassword = 'password' --å¯ç
3. 建ç«ä¸ä¸ªä½ä¸ï¼éè¿ä½ä¸è°åº¦åå¨è¿ç¨ï¼åå¨è¿ç¨ä½¿ç¨ç±»ä¼¼çè¯å¥å°oracleçæ°æ®æå
¥å°sqlserver表ä¸
SQL code?
insert into sqlserver表 select * from test..oracle表å
4. å¦æè¦çORACLEæ°æ®æ¯å®æ¶å¢å çï¼å¹¶ä¸ORACLEè®°å½ä¸æéå¢çå段ï¼å¯ä»¥å¨SQLSERVERä¸é¢å»ºç«ä¸ä¸ªè¡¨è®°å½ä¸æ¬¡æå
¥çidï¼ç¶åä¸æ¬¡å¯ä»¥ä»ä¸æ¬¡çID+1å¼å§ç»§ç»æå
¥
SQL code?
insert into sqlserver表 select * from test..oracle表å where id>@id
5. é²æ¢sqlserveråæ¥çæ¶åoracleä»å¨ä¸æçæå
¥ï¼æ¯æ¬¡è¦åä¸ä¸ªç»æID
SQL code?
select @endid=max(id) from test..oracle表å.
温馨提示:答案为网友推荐,仅供参考