Jack
Jack

Reputation: 7547

Insert query to import data from other database from another server

Normally the Insert query to import data would be:

Insert Into mytable
Select * From otherDB.dbo.Othertable

but problem is otherDB is not within my current server. It is on a different machine hosted online. Can you please tell what changes should be there to import it from different DB?

Upvotes: 0

Views: 1928

Answers (1)

Joe G Joseph
Joe G Joseph

Reputation: 24046

Many options:

If you donot have direct access to the other server from your local server,

  1. You could export the data to a taxt file and transfer the text file to your local machine and import using import/export functionality of SQL sevrer management studio(SSMS)

If you have access to remote server from local server then

  1. Use Linked servers
  2. Use SSIS packages

If data to be imported for many tables then

  1. you could restore the back up of remote database to your local server with a different database name and then move the required tables to your local database

Upvotes: 2

Related Questions