question about how to handle if row exists

  • Thread starter Thread starter jayderk
  • Start date Start date
J

jayderk

Since this is not supported in SQLCE
"IF NOT EXISTS (SELECT customer_id FROM customer WHERE customer_id = '{0}')
INSERT INTO customer(customer_id,event_id) VALUES('{0}','{1}')

what is the recommended way of inserting new rows in the database with a
focus on efficiency?
a) do a try catch on the INSERT statement, if it fails do an UPDATE?
b) check if customer_id exists before trying to INSERT?

customer_id is a primary key


thanks in advanced.
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top