Does any one know where I can find an example of a stored procedure that compares data file B to A.
I need to work out how to set up a procedure that will compare a temp data file with an original data file so that it can choose whether to update existing records or if that record doesn't exist insert a new one.
Personally, I wouldn't use a Stored Procedure. You're going to make things more complex and possibly run slower. It sounds like you're trying to write a simple replication process.
To do that through a Stored Procedure, you'd have to read each record from table one, then try to read it from the second table and update it if it exists (and is different) or insert it if it doesn't exist in the second table. Don't forget that a Stored Procedure will only run when you call it. You could possibly write this as a program and kick it off just as easily.
Certified Pervasive Developer
Certified Pervasive Technician
Custom Btrieve/VB development http://www.mirtheil.com
I do not answer questions by email. Please post on the forum.
Sorry, but I'm new on this SQL stuff. I would have thought that a Stored procedure would have allowed for error trapping and rollbacks.
How does this replication work? Are you suggesting that I call in each record and test to see whether they exist, If it doesn't, then do an insert, else if the record exist, do a test on each field to determine if the field needs to be updated.