Discussion Locked

Table Level Vs Column Level Constraints

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Is there any difference between Table level and column level constraint in terms of performance or any other advantages or disadvantages in SQL SERVER7.0

Thanks from Jamal

5 replies

by roc180

Not really it just of matter of where you want to create the constraint. If you want to apply it within CREATE TABLE use Column level, if you want to apply after the Table is created use ALTER TABLE for Table level. My personel preference is Column level, less lines of code.

Neal Martinelli

by chandrashekargr

Yes, there is going to be some performance issues when you define constraints in the databse at table level and column level. The degree of performance might vary b/w the table and column level constraints. But ofcourse we cannot leave without constraints and we have to bear the cost of it.

Constraints have both advantage and disadvantages which cannot be totally eliminated but they can be improved/minimised. The advantage of constraints is that you are enforcing some the rules to the objects in the database and the disadvantage is the performance will have an impact.

The best way to overcome this problem is to design the database in such a way that you get reasonably good performance.

This discussion is closed to new replies.