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 Administration
 automation addition of a record

Author  Topic 

hass71
Starting Member

1 Post

Posted - 2013-12-10 : 05:57:54
hello

I've two databases with different structures, i want to add a record with it's data from the first database into the second database in the place i define, this action must happen automatically as soon as the record is created in the first database.

any suggestions?

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2013-12-10 : 12:02:36
Best way to keep sync both tables through a SQL Server Agent Job, where you can schedule it according to your requirements.

http://technet.microsoft.com/en-us/library/ms181153(v=sql.105).aspx

--------------------------
http://connectsql.blogspot.com/
Go to Top of Page

jeffw8713
Aged Yak Warrior

819 Posts

Posted - 2013-12-10 : 14:05:31
Not sure an agent job would be the best option - I would think setting up a trigger on the table in the first database or setting up a service broker (best option - in my opinion) would be better.
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2013-12-10 : 14:21:20
quote:
Originally posted by jeffw8713

Not sure an agent job would be the best option - I would think setting up a trigger on the table in the first database or setting up a service broker (best option - in my opinion) would be better.



Yeah, if you can compromise performance

--------------------------
http://connectsql.blogspot.com/
Go to Top of Page

jeffw8713
Aged Yak Warrior

819 Posts

Posted - 2013-12-12 : 13:49:43
Both a trigger and a service broker would not compromise performance. A trigger may cause an increase if there are large transactions - and if that is the case a service broker would be ideal. With a service broker, the updates to the other database/table are asynchronous and will not block or interfere with the original insert/update process.
Go to Top of Page
   

- Advertisement -