MS sql兩個不同資料庫之間 進行資料倒換

2021-05-22 12:31:20 字數 492 閱讀 6518

在資料sql2005中 乙個遠端的庫需要建乙個表aaa 並且需要和 另乙個遠端的庫里的aaa一樣,可採用:

exec sp_configure 'show advanced options',1

reconfigure

exec sp_configure 'ad hoc distributed queries',1

reconfigure

--啟用元件

select * into aaa from openrowset( 'sqloledb', '192.168.13.5'; 'sa'; '',logistics.dbo.aaa)

--資料倒換

exec sp_configure 'ad hoc distributed queries',0

reconfigure

exec sp_configure 'show advanced options',0

reconfigure

--關閉元件 

在兩個不同資料庫之間複製表內容

建立個連線 建立鏈結伺服器 exec sp addlinkedserver srv lnk sqloledb 遠端伺服器名或ip位址 exec sp addlinkedsrvlogin srv lnk false null,使用者名稱 密碼 go 查詢示例 select from srv lnk.資...

兩個不同的資料庫之間查詢資料,怎麼辦?

這週接了乙個任務,任務有個難點,相關聯的兩個表在不同的庫中。像我這樣的菜鳥,之前沒乾過這活啊,但身為程式猿,還是要幹的。第一反應能不能跨庫查詢,連線兩個資料庫查詢。說幹就幹!如下 用最原始的方法鏈結資料庫 mysqli new mysqli localhost 使用者名稱 資料庫密碼 資料庫名稱 第...

資料庫中查詢兩個日期之間的資料

從資料庫中查詢時間在兩個日期之間的記錄,例如 查詢建立時間在2014 11 06到2014 11 13之間的記錄!select from t entry deliver info where modify tm 2014 10 13 andmodify tm 2014 11 14 語句報錯 sql錯...