Call the built-in sp_addmediaserver stored procedure. The Code is as follows: execsp_addmediaserveradb (alias of the server to be connected), SQLOLEDB, server to be connected -- a user-defined Instance name and Instance name execsp_add1_srvloginadb can be used to use another database by alias.
Call the built-in sp_addmediaserver stored procedure. The Code is as follows: EXEC sp_addmediaserver 'adb (alias of the server to be connected) ',', 'sqloledb ', 'server to be connected '-- if you have a custom Instance name, you must add "/Instance name" EXEC sp_add1_srvlogin 'adb' to execute the command and then use the alias to use another database.
Call the built-in sp_addmediaserver stored procedure. The Code is as follows:
EXEC sp_addlinkedserver 'adb (alias of the server to be connected) ',', 'sqloledb', and 'server to be connected '-- add "/Instance name" to the custom Instance name"
EXEC sp_add1_srvlogin 'adb'
After execution, you can use an alias to use another database.
Select * from ADB. datawarehouse. dbo. Table1