Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2005

    Unanswered: Stored Procedures

    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.


  2. #2
    Join Date
    Dec 2001
    Provided Answers: 6
    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.
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    I do not answer questions by email. Please post on the forum.

  3. #3
    Join Date
    Feb 2005
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts