nauna says:
hi,
in sql server we can have unique constraints so column can have unique record like if ID 1 is added in column with unique constraint it can be added again, is there any possibility that column allow ID 1 two times instead of one time and when third time ID 1 added so it gives exception
You can not Insert Same value again if you assigned Column as Unique key.
Unique key constraints are used to ensure that data is not duplicated in two rows in the database. One row in the database is allowed to have null for the value of the unique key constraint.
If you try to insert or update column with same value exist it will throw the error at insert or update time of Violation of UNIQUE KEY constraint.
If your requirement is based on same column can exist same value at two time then you don’t need to add unique key just add column with no constraint but you always need to check in insert or at time of update that same column will not exceed by more than two time by checking same column value count.
But you can’t do it with using unique key constraint.