是否有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.