unique values in sql server

  • Thread starter Thread starter Phil Townsend
  • Start date Start date
P

Phil Townsend

How does one enforce uniqueness of a column when there is already a
primary key defined elsewhere in the table? Scenario: I have to add to
an application that stores usernames and passwords in a table. The PK is
already estabished and set to an autonumber int. Relationships are
already built upon this value so making changes to the schema are not an
option. I would like to be able to generate an error if an end user
attempts to insert a username that already exists in the DB. I would
prefer to generate this error from SQL Server rather than from the
application. How might I go about this? Thanks!
 
Back
Top