Announcement

Collapse
No announcement yet.

Replace Into vs Update

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Replace Into vs Update

    I have a table defined with a unique index on a field that should never be a duplicate theoretically. IOW, based on that field, there will never be a possibility of a duplicate. It's possible however that the record would get updated frequently.

    I was having some clumsy like problems inserting a record and then updating it. Switching to "Replace Into" instead of "Insert Into" and dropping the individual "Update" routine seems to have solved that clumsiness. I haven't used "Replace" before. Are there any new issues I've created using this technique?

    Thanks,

    Scott
    Need to offer Shipping Insurance?
    Interactive Design Solutions https://www.myids.net
    MivaMerchant Business Partner | Certified MivaMerchant Web Developer
    Competitive Rates, Custom Modules and Integrations, Store Integration
    AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
    My T-shirt Collection is mostly MivaCon T-shirts!!

    #2
    Replace = update if exists | insert if not exists. In some cases it can be a shorthand form, but I've avoided it because 1) it is not standard with all db engines and 2) it sort of obscures my intent (especially important to me when returning to code after six months).

    I see no problems otherwise, but I'd wonder why you had problems with insert followed by update - that indicates a possible bug.
    Gordon Currie
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit Any Document Easily | Free Modules | Follow Us on Facebook
    phosphormedia.com

    Comment

    Working...
    X