[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 376
  • Last Modified:

how to code transerfering data from one database table to another when on different servers

I am unsure of how to code transferring data from one table in one database to another when on the same network but different server
ex:
INSERT INTO [acisql2].[dbo].[OPIS_LOGS]
           ([OPISLOG_KEY]
           ,[OPISLOG_PRMTLINK]
           ,[OPISLOG_PRMT]
           ,[OPISLOG_TIMESTAMP]
           ,[OPISLOG_UCODE])
     SELECT
           [OPISLOG_KEY]
           ,[OPISLOG_PRMTLINK]
           ,[OPISLOG_PRMT]
           ,[OPISLOG_TIMESTAMP]
           ,[OPISLOG_UCODE]
FROM [JasperTest].[dbo].[OPIS_LOGS]

Open in new window

so how would I change the setup for the FROM ..... to connect to a different database on a different server
0
Tagom
Asked:
Tagom
1 Solution
 
rbrideCommented:
You set up a linked (SQL) server with the management studio and assuming you have sufficient permissions on the remote server just use the four part syntax [OTHERSERVER].[OTHERDB].[dbo].[TABLE]

But NOTE! If there are lots of rows in the remote table, that's a really slow way to do it. There are other ways such a bulk copy (BULK INSERT).
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now