Cross-server, cross-database SQL

- before executing a query across servers, running
Exec sp_configure 'Show advanced Options', 1
reconfigure
Exec sp_configure 'Ad Hoc Distributed Queries', 1
reconfigure

INTO the OPENDATASOURCE INSERT (
'the SQLOLEDB',
'= the Source address of the Data; User ID = user; Password = password'
) .dbo database table name..
SELECT * from local name table

- After the inquiry, run
Exec sp_configure 'Ad Hoc Distributed Queries', 0
reconfigure
Exec sp_configure 'Show advanced Options', 0
reconfigure

Guess you like

Origin www.cnblogs.com/vsnb/p/11597035.html