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 is the security principal at the server level that represents your session?

638


What is difference between delete & truncate commands?

621


How to create a view with data from multiple tables?

667


What are different types of constraints?

607


What is “asynchronous” communication in sql server service broker?

635






What are the different types of upgrades that can be performed in sql server?

797


What is the bookmark lookup and rid lookup?

656


How to write the storeprocedure with in the store procedure? and how can we write the store procedure with in a trigger vice versa? plz post me the exact answer?

2227


What are temporal tables in sql server 2016?

560


What are the properties of primary key?

618


How to include text values in sql statements?

675


How to rename an existing table with the "sp_rename" stored procedure in ms sql server?

636


What is sql server english query?

641


How do you start single user mode in clustered installations?

605


How to delete database objects with "drop" statements in ms sql server?

672