TSQL命令连接到另一台服务器(SQL Server 2005)

是否有Tsql命令连接到另一台服务器?

或者当您在查询窗口中时,连接到另一台服务器并显示查询窗口的键盘快捷键是什么?

我已经看到Ctrl N在某些屏幕中弹出了“连接到服务器”对话框,但是当我在查询窗口中并按下Ctrl N时,它只会打开另一个查询窗口.

USE命令允许您连接到当前服务器上的其他数据库,但是有一个命令可以让您连接到另一台服务器吗?

我正在使用sql Server 2005.

解决方法

您可以将 OpenDataSource链接服务器一起使用
OpenDataSource(provider_name,init_string)

例如

SELECT
FirstName,Gender
FROM
OpenDataSource (
'sqlOLEDB','DataSource = NOLI\sql2;UserID=myUserID;Password=myPassword'
).Organisation.dbo.Employees

MSDN起 –

Like the OPENROWSET function,OPENDATASOURCE should only reference OLE DB data sources that are accessed infrequently. Define a Linked Server for any data sources accessed more than several times. Neither OPENDATASOURCE nor OPENROWSET provide all the functionality of linked-server deFinitions,such as security management and the ability to query catalog information. All connection information,including passwords,must be provided every time that OPENDATASOURCE is called.

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...