Jeff,

> Thanx for your help.  I found replace into to be a nice convience since my
> primary keys are often expressions build from several fields which I want to
> keep unique.  Replace into enforces this uniqueness.  I was learning SQL
> when I started this project so I didn't know this was non-standard.  Bummer.

No, what you're describing are called "composite keys".  They are a
standard part of SQL, but most developers end up using numerical
surrogate keys because they are easier to handle.

> But since my primary keys are expressions, I can't use the technique you
> suggested.  I'm thinking of simply trying the insert and checking to see if
> I get an error.  If I get an error, I do an update...  Not sure how well
> this will work, tho.

Better to do it the other way. Search for that key; if it's returned, do
an update; if the results are NULL, do an insert.  If your table has few
fields (<15) you can even do this through a function, passing the field
values as parameters of the function.

                                        -Josh Berkus

-- 
______AGLIO DATABASE SOLUTIONS___________________________
                                        Josh Berkus
   Complete information technology      [EMAIL PROTECTED]
    and data management solutions       (415) 565-7293
   for law firms, small businesses       fax  621-2533
    and non-profit organizations.       San Francisco

Reply via email to