Home > SQL, Tips And Tricks > Adding a UNIQUE constraint

Adding a UNIQUE constraint

I always forget how to do this and then have to spin my wheels searching websites for it. Finally, decided to post it on my blog so I (and others) can quickly get to it:

ALTER TABLE SomeTable
	ADD CONSTRAINT unique_key
	UNIQUE (ColumnOne, ColumnTwo, ...)
Kick It on DotNetKicks.com Shout it
  1. No comments yet.
  1. No trackbacks yet.