Create View using Linked Server db in SQL Server

前端 未结 7 779
醉酒成梦
醉酒成梦 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:59

    Its a SQL Management Studio Issue. If you try to create the view using management studio NEW VIEW then you get that error incorrect syntax.

    But if you use SQL Query:

    CREATE VIEW [dbo].[viewname] 
    AS 
        SELECT  * 
        FROM    [0.0.0.0].database.dbo.table 
    GO 
    

    then it will work.

    To test you will see the view created when you refresh views. If you just do a select query from the view you will see the view return results.

    But if you try to go into design mode for that view and try executing the design query the error will pop up again even though the view was successfully created.

提交回复
热议问题