How to write SQL statements across servers

select * into native library name table .. the OPENDATASOURCE from ( 
                'the SQLOLEDB', 
                '= the Source the Data remote ip; User ID = sa; Password = password' 
                ) .dbo library name table. 

insert native library name table .. the OPENDATASOURCE from ( 
                'the SQLOLEDB', 
                '= the Source the Data remote ip; User ID = sa; Password = password' 
                ) .dbo library name table. 

Or junction server: 
EXEC the sp_addlinkedserver   
    'alias',   
    '',   
    'the MSDASQL', 
    NULL, 
    NULL, 
    'the DRIVER = {the SQL Server}; SERVER = remote name; UID = user; PWD = Password;' 
the GO 
then you may be as follows : 
.. select * from table name alias library name .dbo 
.. insert library name .dbo select * from table name aliases .. library name .dbo table name 
. select * into the library name .dbo new table name from the alias library .. name .dbo. table name 
go

Guess you like

Origin www.cnblogs.com/sxjljj/p/11347008.html