Our application does the following when inserting or updating a record
1. Check to see if the record exists
2. If it exists - do an UPDATE else do an INSERT
I'm wondering if there is a way to do one or the other without making the query to see if it exists in the first place. I know about uniqueness and constraints, but what I would like to do is make one call and it either updates or inserts depending on the existence of the record. A stored procedure is kind of tough because some of the records may have up to 20 columns/parameters.
Can this be done?
1. Check to see if the record exists
2. If it exists - do an UPDATE else do an INSERT
I'm wondering if there is a way to do one or the other without making the query to see if it exists in the first place. I know about uniqueness and constraints, but what I would like to do is make one call and it either updates or inserts depending on the existence of the record. A stored procedure is kind of tough because some of the records may have up to 20 columns/parameters.
Can this be done?