Use DataBaseName/*開啟Ad Hoc Distributed Queries組件exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure*/Insert into tableName (col1,col2,col3,……) --字段不能含有主鍵SELECT col1,col2,col3,……from opendatasource
('SQLOLEDB','Data Source=192.168.0.1;User ID=dbuser;Password=123456'
).DataBaseName.dbo.tableName
WHERE [datetime]>'2016-11-01 15:00:18.663'
AND [datetime]<'2016-11-01 15:00:18.663'/*關閉Ad Hoc Distributed Queries組件exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure
*/
?