Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Merge Statement One Server to another


Merge Statement One Server to another

Author
Message
SqlServerNinja
SqlServerNinja
Valued Member
Valued Member (58 reputation)Valued Member (58 reputation)Valued Member (58 reputation)Valued Member (58 reputation)Valued Member (58 reputation)Valued Member (58 reputation)Valued Member (58 reputation)Valued Member (58 reputation)

Group: General Forum Members
Points: 58 Visits: 197
Hello,

I have a requirement where I need to insert/update data from a Table A in SqlServer A to
a Table B of a reporting database in SqlServerB .

Currently, I am using a staging table to achieve my task.

I have used merge statements in the past .. but that was only for running queries within the same
sql server.

I would like to know if a merge statement can be used directly to copy from a database from one
Sql Server and insert/update to a database in another Sql Server. ? ( I am planning to use the merge
statement with ssis)
Dana Medley
Dana Medley
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2316 Visits: 1691
The target table cannot be remote. Here's a link to a previous posting that might be of some use to you.

http://www.sqlservercentral.com/Forums/Topic834948-391-1.aspx



Everything is awesome!
Orlando Colamatteo
Orlando Colamatteo
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8275 Visits: 14368
Even if MERGE supported such changes, chances are the source resultset from the MERGE would need to be completely copied to the remote server in order to facilitate. Consider creating a table on the remote server, copying your source resultset into it, and then issuing a MERGE on the remote server using EXEC() AT [LinkedServer].

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search