I know this is probably a very basic question but how do I keep a column's text values unique in SQL server (ie for a unique username)? The column is not an integer it's varchar(50), and it's not the primary key but I could make it the primary key if recommended.
The front end could handle it; where the user would enter text, it's validated, then a query is done to see if that username is available. If so, then user can decide to choose it and an insert is done, if not they pick a new username and process repeats. With this approach, the responsibility of keeping the value unique solely rests on the front end, nothing on the database side.
Is this the correct way to handle this?
View Complete Post