-2

I need copy database from some server to my local machine database.

HOST REMOTE SQL SERVER (READ ONLY PERMISSIONS) ----- TO --- > MY LOCAL SERVER

Thanks Advance

  • `Is it possible to create a SQL script to copy a database from some remote server to local server, running script in local server?` - Probably. – joeqwerty Jul 24 '17 at 18:18

1 Answers1

1

Yes.

First off, you ask such a vague question, there's no way for anyone to answer correctly, without making loads of assumptions.

You can use a INSERT INTO SELECT[1] or a SELECT INTO[2]

You just have to refer to the complete namespace of the database and have the correct privileges on both databases.

INSERT INTO Localserver.database.schema.MyLocalTable 
SELECT * FROM RemoteServer.Database.Schema.MyRemoteTable
WHERE MyConditions

[1] https://www.w3schools.com/sql/sql_insert_into_select.asp

[2] https://www.w3schools.com/sql/sql_select_into.asp

Protip for next question: ask a question after doing a simple lookup on https://google.com first, and ask in a way where the answer is not yes or no.

mdavidsen
  • 73
  • 8