timotech (3/25/2013)
Hi All,Please i need an answer to this question. I have two servers, one locally and one hosted, i normally upload data to the online one using data export wizard. but the local database is now connected to an application that adds data to it almost every second.
This is what i want to do
1. write a trigger for insert that will insert the data to the hosted server(database) anytime the local database table is added with data(pardon my English)
2. Is it posible to do upload data from a local database to an online database through a trigger, a sample script will guide me through.
Thanks
Tim
while technically possible, it's not worth it;
if the remote server is unavailable, the trigger would fail, and you would lose the data in both the local database(due to transaction rollback) and at the remote as well.
you've already got someway to determine what is new, so you want to use something like Replication to get the data to the remote server instead; Other possibilities could be using Extended events or a scheduled job to get the changes moved as well; it really depends on the job .
Have you looked into replication at all? it's very easy to set up, lots of examples out there, and once it's set up, SQL does the work for you.
you can replicate one table, or the whole database if needed.
Lowell