Using T-Sql, how can I insert from one table on a remote server into another table on my local server?

Posted by GenericTypeTea on Stack Overflow See other posts from Stack Overflow or by GenericTypeTea
Published on 2010-12-23T19:03:27Z Indexed on 2010/12/23 19:54 UTC
Read the original article Hit count: 208

Filed under:
|
|

Given the remote server 'Production' (currently accessible via an IP) and the local database 'Development', how can I run an INSERT into 'Development' from 'Production' using T-SQL?

I'm using MS SQL 2005 and the table structures are a lot different between the two databases hence the need for me to manually write some migration scripts.

UPDATE:

T-SQL really isn't my bag. I've tried the following (not knowing what I'm doing):

EXEC sp_addlinkedserver 
    @server = N'20.0.0.1\SQLEXPRESS', 
    @srvproduct=N'SQL Server' ;

GO

EXEC sp_addlinkedsrvlogin '20.0.0.1\SQLEXPRESS', 'false', 
    'Domain\Administrator', 'sa', 'saPassword'

SELECT * FROM [20.0.0.1\SQLEXPRESS].[DatabaseName].[dbo].[Table]

And I get the error:

Login failed for user ''. The user is not associated with a trusted SQL Server connection.

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server-2005