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
 Select and insert from different databases

Author  Topic 

krishna_yess
Yak Posting Veteran

81 Posts

Posted - 2009-05-25 : 05:04:03
Hi,
I need to insert data to a table by select data from some other table which is in different database(diff server).

And it should be automatic when ever some data is inserted into other table (in fact its a view) for which i have only read access.

how can i do this, will trigger work here.

nr
SQLTeam MVY

12543 Posts

Posted - 2009-05-25 : 05:13:38
>> diff server
Is the important bit
You could use a trigger and linked server but that would hold a transaction for the insert and if there were any problems it would fail. Would also be slow which could cause more problems.

Depends how synchronous you want it to be.

Better to insert into a staging table on the source server, copy that table data to the destination server (using a identity?) and insert from there.

Could also use replication, log shipping, ...

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-25 : 09:57:39
you could schedule a job for doing this transfer periodically by using staging table method suggested by nr
Go to Top of Page
   

- Advertisement -