
January 14th, 2009, 07:59 AM
|
|
Contributing User
|
|
Join Date: May 2006
Posts: 763
Time spent in forums: 2 Days 3 h 52 m
Reputation Power: 4
|
|
|
Smarter ways to make a column value unique
Hello everyone,
I have a table and a couple of columns in this table. For some specific column, it is not primary key, but I want to accept only unique value for this specific column for each row.
Currently, my naive solution is to use a store procedure to handle table insertion and if in the store procedure I find there is already a row whose existing value for the specific column is the same as the new column value of the new row to be inserted, I will return error from the store procedure and refuse to insert the whole new row.
Any other smarter ways?
thanks in advance,
George
|