What is the difference between constraints and triggers?

Answer Posted / sairam

Both will be used to implement business rules.

Constraints will do memory location to table comparision.
where as triggers will do table to table comparision.
for this triggers will use magic tables(inserted,deleted).

In the order of precedence first Constraints next Triggers,
But performance wise triggers will give best performance
because table to table comparision is faster than memeory
location to table comparision.

Is This Answer Correct ?    17 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are cursors? : Sql server database administration

519


If we delete pack Spec what will be the status of pack Body ?

970


What is compound operators?

552


Detail about query optimizer?

616


Explain what are various ways to enhance the ssrs report?

572






What is a with(nolock)?

581


Explain “@@rowcount” and “@@error” in sql server?

541


What is a db view?

520


What is temporal data type?

526


Explain the disadvantages/limitation of the cursor?

566


What is the difference between varchar and nvarchar datatypes?

574


Why use triggers?

577


What are clustered and non-clustered index?

550


How to encrypt data between dialogs?

574


Explain what are the restrictions that views have to follow? : SQL Server Architecture

597