March 2, 2012 at 11:22 pm
Hi All,
I have a problem. I would really appreciate if anyone could help me..
I have a table in my DB having name as EMAIL_ID. I dont want duplicate entries in the table. So i thought of making the email id column as unique. But the problem is if someone tries to enter the same email id again, I am sure DB would throw "unique key constraint violation". Would this exception hamper the DB. OR would it just not allow to make a duplicate entry and DB would function normally. I dont want any duplicate entries in my table. What should be the code that I should be writing to handle this exception if needed?
Please help and its really urgent.
Thanks in Advance
Arijit
March 3, 2012 at 1:47 pm
Make and unique index in such a column then handle the exception properly so to return a more polite message to the user - an alternative would be to do it programmaticaly by selecting from the table before attempting to insert.
Nothing bad would happen to the database - don't worry.
_____________________________________
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at Amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply