--不同SQL Server数据库之间的跨数据库查询 EXEC sp_addlinkedserver @server=N'OldDatabase', --自己定义别名 @srvproduct=N'', @provider=N'SQLNCLI', @datasrc=N'10.199.123.123SQL2008R2' exec sp_addlinkedsrvlogin 'OldDatabase', 'false',null, 'sa', '123' SELECT TOP 1000 [Id] ,[CreatedBy] ,[CreatedDate] ,[LastUpdatedBy] ,[LastUpdatedDate] FROM [OldDatabase].[MCU].[DCL].[SystemResource] exec sp_droplinkedsrvlogin 'OldDatabase',null exec sp_dropserver 'OldDatabase'