我想从另一个服务器的另一个数据库中选择一些数据。
我知道的是添加一个链接服务器,然后运行 T-SQL。
这种方式是不错的选择,还是有其他方式可以在其他数据库服务器上运行SQL?
谢谢。
最佳答案
添加链接服务器就可以了。
然后您可能会使用 4 part naming convention
select * from [server].[database].[Owner or Schema].[tablename]
或者你可以看看OPENROWSET (Transact-SQL)
Includes all connection information that is required to access remote data from an OLE DB data source. This method is an alternative to accessing tables in a linked server and is a one-time, ad hoc method of connecting and accessing remote data by using OLE DB. For more frequent references to OLE DB data sources, use linked servers instead.
关于sql - 如何在另一个数据库服务器上运行 T-SQL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12418044/