Which is better in performance - CONSTRAINT or TRIGGER over
a column which restricts say an input of particular value
in a column of a table?

Answer Posted / monal

Constraints gets evaluated before statement can be either
inserted or deleted or updated. While trigger executes
after or at the same time statement is executing. So if you
have to roll back transactio because transaction not
meeting condition there is no overhead when you are using
constraint ,but if you have to roll back transaction and
you have a trigger on that table or column either 1
transaction goes through before rolling back. So basically
trigger consumes more resources.

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between varchar and nvarchar?

527


How to call a function from a stored procedure in SQL Server ?

553


What happens if time-only values are provided as date and time literals?

531


What is the recovery model?

564


What happens if strings are casted into wrong code pages in ms sql server?

568






How global temporary tables are represented and its scope?

551


How to generate create view script on an existing view?

562


Define outer join?

538


explain different types of joins? : Sql server database administration

531


What is a document index?

590


Explain the cursor lock types?

556


Define magic tables in sql server?

571


What are relationships and mention different types of relationships in the dbms

558


What are data resources?

506


What is service broker?

589