我可以在另一个数据库服务器的数据库服务器中创建视图

问题描述:

是否可以在我的数据库服务器中创建另一个服务器数据库表的视图?

Is it possible to create view in my database server of another servers database table?

假设您在 server1上有一个名为 Testing 的数据库并且在 server2 上有另一个数据库 Testing2 。是否可以在 server1 $ c>中创建 Testing2 的视图 Table2 $ c>的数据库测试

Let's say you have a database called Testing on server1 and you have another database Testing2 on server2. Is it possible to create view of Testing2's table Table2 in server1's database Testing?

此外,我使用SQL Server 2008。

Also, I am using SQL Server 2008.

如果您有任何问题,请让我知道。

Please let me know if you have any questions.

感谢,

是的,你可以。首先,您需要使用 sp_addlinkedserver 链接到其他服务器。

Yes, you can. First, you need to link to the other server, using something like sp_addlinkedserver.

然后您可以访问数据使用4部分命名。下面是一个示例:

Then you can access the data using 4-part naming. Here is an example:

create view v_server1_master_tables as
    select *
    from server1.master.information_schema.tables;