Create View using Linked Server db in SQL Server

前端 未结 7 815
醉酒成梦
醉酒成梦 2020-12-30 04:06

How can I create View on Linked Server db. For Example I have a linked server [1.2.3.4] on [5.6.7.8]. Both db servers are SQL Sserver 2005. I want to create View on [5.6.7.8

7条回答
  •  不知归路
    2020-12-30 04:58

    You need to use the four part qualified name: linkedserver.database.schema.table

    SELECT * FROM [1.2.3.4].Northwind.dbo.Customers
    

    Here is an MSDN article about accessing object names.

    You might want to try manually creating the view, rather than using the SQL Management tools:

    CREATE VIEW [dbo].[sywx]
    AS
        SELECT  *
        FROM    [1.2.3.4].Atia.dbo.IpPbxDCR
    GO
    

    I also recommend that you use a name, if possible, for the linked server rather than using the IP address.

提交回复
热议问题