× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



From: Wilt, Charles

I'm not sure Joe's answer would work given the following data:

----------------------------------------------
| File A
----------------------------------------------
| ssn | job | date
----------------------------------------------
| 0023 | Cust | 070725
| 0023 | Cust | 070726
| 0023 | Fodserv | 070728
| 0023 | Fodserv | 070810

As it would attemp to update both "Cust" records and you'd still get the
duplicate key.

Interesting point, Charles! It all depends on whether SQL selects all the
records and attempts to update each one, or whether the select is dynamic
based on the data.

Technically, one the first Cust record is updated, the WHERE NOT EXISTS for
the second Cust record is no longer true. It's an interesting question.
Time for a test...

And the answer is DING! DING! DING! Charles got it in one! It turns out
that an update will attempt to update both records, which indicates that the
WHERE criteria is used only when building the set to be updated, not as the
updates occur. This makes sense, I think, but it's not 100% intuitive.

So beware this gotcha, Pete!


On the other hand....mine would still work ;-)

Yes it absolutely would, with the nitpick caveat that the RRN scalar
function is not standard among other databases.

Joe



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.