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

Can we call future method from queueable?

780


What is the difference between a stored procedure and a user defined function?

785


What are the encryption mechanisms in sql server?

759


Using the customer, and order table in northwind database, please write a query to produce xml?

870


What are the different Topologies in which Replication can be configured?

898


What is the sql case statement used for? Explain with an example?

765


What are different types of raid configurations? : SQL Server Architecture

760


What are the results of running this script?

700


What is difference between getdate and sysdatetime in sql server 2008?

815


What is the order by used for?

807


How do I create a stored procedure in sql server?

720


List the different types of collation sensitivities in sql server?

756


Do you know how to send email from database?

755


List out what other servers you can use with ssrs?

117


What command must you use to include the not null constraint after a table has already been created?

781