SQL Server/T-SQL Tutorial/System Functions/sp addlinkedserver

Материал из SQL эксперт
Перейти к: навигация, поиск

Add a server link

sp_addlinkedserver [@server =] "<server>"
    [, [@srvproduct =] "<product name>"]
    [, [@provider =] "<provider name>"]
    [, [@datasrc =] "<data source path>"]
    [, [@location =] "<location>"]
    [, [@provstr =] "<connection string>"]
    [, [@catalog =] "<database or equivalent for datasource>"]
EXEC sp_addlinkedserver @Server = "MyLocalServer",
      @srvproduct = "SQLServer OLEDB Provider",
      @provider = "SQLOLEDB",
      @datasrc  = "SOCRATES"
   SELECT CustomerID, CompanyName
   FROM MyLocalServer.Northwind.dbo.Customers
   WHERE CustomerID < "1"