in reply to Re: checking to do a insert or update
in thread checking to do a insert or update

Another similar variation, which I typically use, is to check whether the record exists (either using a hash, as described, or by doing a SELECT if there's a reasonable possibility of the database having been changed), then call a stock INSERT to create a dummy record if it's not already there, and finally run a standard UPDATE regardless of the initial search's result.

Less efficient in execution, but easier to work with since I only need to keep a single UPDATE statement current rather than both an INSERT and an UPDATE.

  • Comment on Re: Re: checking to do a inser or update