1

Need to add some sort of constraint on my table column. I need to make sure that the user does not enter, manually or otherwise, the same text in more than one row of the table. How can I achieve this?

Kobojunkie
  • 6,375
  • 31
  • 109
  • 164

1 Answers1

2

You'll want to use some type of unique constraint or, of course, the primary key would work as well. For example:

ALTER TABLE MyTable ADD CONSTRAINT UK_MyUniqueConstraint UNIQUE (MyColumn)

There are other methods of creating this discussed on SE as well.

Community
  • 1
  • 1
Tim Lehner
  • 14,813
  • 4
  • 59
  • 76