3 Replies - 341 Views - Last Post: 11 June 2019 - 10:57 AM

#1 DarenR   User is offline

  • D.I.C Lover

Reputation: 634
  • View blog
  • Posts: 4,218
  • Joined: 12-January 10

How to copy info from a server select into another server db

Posted 11 June 2019 - 09:44 AM

ok here is the scenario

one production server has the info that is gathered with a select and i must take that select do a run on it and have the data populate another servers database with the results.

i have seen examples on copying tables from one server to another but none on copy select results to another server. as an fyi, i can not make any temp tables on the production server.

what i was going to do is something like follows:

INSERT INTO [destinationServer].[DestinationDB].[dbo].[table]




select distinct items (to many to list)
    case when i.SvcFrequency = 'CALL' then 'On-Call'
    
from somewhere
       join table c on ...
       join table2 on ...
       join table3 on ...
       join table4 on ...
       left join table5 on ...
       join table6 ss on ...
where ...
    
order by 1
       



does it look like im missing anything?
any thoughts?

Is This A Good Question/Topic? 0
  • +

Replies To: How to copy info from a server select into another server db

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15359
  • View blog
  • Posts: 61,588
  • Joined: 12-June 08

Re: How to copy info from a server select into another server db

Posted 11 June 2019 - 10:41 AM

Given you are not allowed to make temp tables.. are you allowed cross server joins? Typically those have a large ding for security and also performance hits... ignoring the 'tightly-ier coupled' nature.

In my current environment I have an app that is tasked with thrice daily (or once a day) pull from another environment data and fill in SQL tables as needed.. It works well.
Was This Post Helpful? 0
  • +
  • -

#3 DarenR   User is offline

  • D.I.C Lover

Reputation: 634
  • View blog
  • Posts: 4,218
  • Joined: 12-January 10

Re: How to copy info from a server select into another server db

Posted 11 June 2019 - 10:50 AM

this is about the extent i can do
some variables
INSERT INTO [one server].[db].[dbo].[table]
select (a bunch of fields), variable1, variable2
from  [another server].[db].[dbo].[table]


im hoping that does the trick-- kinda scared to hit go for a test ha
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15359
  • View blog
  • Posts: 61,588
  • Joined: 12-June 08

Re: How to copy info from a server select into another server db

Posted 11 June 2019 - 10:57 AM

meh.. it's just one table.. worse of it you can burn it all and start over.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1