Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 transferring records between databases

Author  Topic 

Nemesis85
Starting Member

6 Posts

Posted - 2011-01-29 : 04:24:31
Hi,
I think this is simple to make , but I am not sure how.
How to send records from table in database to table in another database in another SQL server?what is the script needed?

Ex:
table1 -----sending records--------> table2
DB1---------------------------------> DB2
SQL server1-------------------------> SQL server2

and also what about mapping between the two tables fields?

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2011-01-29 : 06:15:53
Depends on what you mean by "send records"?


the servers would need to be linked, and the column mapping is something you would specify.



Poor planning on your part does not constitute an emergency on my part.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-01-29 : 11:01:15
you just need a scheduled job in sql agent if you want this to be automated and want this to happen periodically.
If its an adhoc transfer you just need to use query like

INSERT INTO table2
SELECT <columns> FROM Server1.DB1.dbo.table1

for the above to work setup a linked server b/w server1 and server2

for details see below

http://www.databasejournal.com/features/mssql/article.php/3691721/Setting-up-a-Linked-Server-for-a-Remote-SQL-Server-Instance.htm

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -