Yes it is. You can create a linked server with another server, and then run a linked server request with another server in the same batch. Here's how:
USE [master]
GO
EXEC master.dbo.sp_addlinkedserver @server = N'ServerName', @srvproduct=N'SQL Server'
GO
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname = N'ServerName', @locallogin = NULL , @useself = N'True'
GO
USE [UserDB]
Create Table
(
Test int not null
);
insert into
select 1
select *
from ServerName.DBName.dbo.Table
where Col1 in (select Test from
Connect the server name, make sure that your login credentials work on both servers and follow the naming scheme of the 4 parts on the last line.
source
share