1. 程式人生 > >SQL Server遠程連接操作

SQL Server遠程連接操作

選項 configure col rom from eight lec logs 方法

-- 開啟遠程選項
exec sp_configure show advanced options,1
reconfigure
exec sp_configure Ad Hoc Distributed Queries,1
reconfigure


-- 方法1:
SELECT top 5 * FROM OPENDATASOURCE(SQLOLEDB,Data Source=192.168.2.208;User ID=sa;[email protected]).[CCPG_PM].dbo.[COM_UserInfo] P where p.[GC_Flag]=0

--
方法2: SELECT top 5 * FROM OPENROWSET(SQLNCLI,192.168.2.208;sa;[email protected],select * from [CCPG_PM].dbo.[COM_UserInfo] P where p.[GC_Flag]=0) AS a -- 關閉遠程選項 exec sp_configure Ad Hoc Distributed Queries,0 reconfigure exec sp_configure show advanced options,0 reconfigure

SQL Server遠程連接操作