• mishaluba (10/15/2010)


    Thank you for the article, Leo! I found it interesting. A couple of questions please. Could you clarify what is behind this line:

    raiserror (51080, 10, 1); -- Alert that will start job

    I am just curious about possible implementations. I have been starting jobs from T-SQL code using sp_start_job procedure, but is there a way to actually trigger it from the alert?

    Secondly, I would like to better understand the mechanism for transferring changed records. Here is my understanding. We have a control table on the Destination server and, based on this table, we know the ID's of the records we need to bring in (where Processed_FLG is 'N'). We then wrap these ID's into an XML and pass this XML to the stored procedures on the Source server. When these procedures run, they grab necessary records and somehow push them to the Destination (via linked server or how?). Please let me know if this is correct.

    Thank you!

    raiserror (51080, 10, 1); - when you registering alert you associate it with the error message. I created custom message 51080. It means when this error is raised the alert is fired by sql server. Then alert can be associated with a job. E.g. when alert is raised it fired the job. But then job runs completely independently from the transaction that was fired the raiserror command.

    Idea of the process is simple: control table that is keeping changes is on the source. When job fired it transferring knowledge about changes to the destination server where it written in similar control table with status not processed. And then it processing changes. There are many variations how to organize the process. It can be done by using centralized hub if you have to distribute changes to many servers or it can be done directly server to server if you need it only for one server.