SQL 2000: SQL Statement OR Trigger Help - TechRepublic
General discussion
September 13, 2001 at 04:29 AM
bgibilaro

SQL 2000: SQL Statement OR Trigger Help

by bgibilaro . Updated 24 years, 9 months ago

Here we go: I have a SQL SERVER 2000 database. In it I have a table(1) that is updated every half hour or so by a COBOL extraction(Outsourced. not in-house) I have created another table(2) and imported all the information from table(1) into it. Every time that table(1) is updated I want it to be mirrored in table(2). They are both on the same machine and in the same database. Unfortunately, this configuration can not change, so I have to work within these constraints.

My first idea was to create a simple asp script that runs on the server that will periodically compare the 2 and then insert any data from table(1) into table(2) that does not already exist there. The problem I am having here is that my SQL statement is not just returning data that does not exist, but is taking each row and comparing it to every other row and returning any combination of the two that do not match, so I am getting thousands of returned recordsets.

I either need a SQL statement that will look at bothtables and only return the data that does not exist in both, or a trigger that will take any updated or newly inserted data from table(1) and automatically insert or update it in table(2). Thank you for your help.

This discussion is locked

All Comments