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?

Answers were Sorted based on User's Feedback



Which is better in performance - CONSTRAINT or TRIGGER over a column which restricts say an input ..

Answer / jerry joseph

Restricting the input using CONSTRAINT will have better
performance but there is a limit to the types of constraints
which we can provide..

With TRIGGERS you have more flexibility and provide a more
variety restrictions to the input.. for example you can
prevent a normal delete and make it a soft delete by setting
an IsDeleted flag using trigger.. we cant have that kind of
flexibility using Constraints..

Is This Answer Correct ?    6 Yes 1 No

Which is better in performance - CONSTRAINT or TRIGGER over a column which restricts say an input ..

Answer / 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

Which is better in performance - CONSTRAINT or TRIGGER over a column which restricts say an input ..

Answer / guest

Constraint is better in terms of performance for same
operation. Why??

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More SQL Server Interview Questions

What are the new features in SQL Server 2005 when compared to SQL Server 2000?

0 Answers  


How to list all columns in a table using odbc_columns()?

0 Answers  


What is ACID Property of Transaction?

10 Answers  


What are trace flags and mention a few common trace flags used with sql server?

0 Answers  


what is the difference between delete table and truncate table commands? : Sql server database administration

0 Answers  






What meant by Performance Tuning,how can we do the performance tuning on stored procedures and tell some steps to do the performance tuning

3 Answers   TCS,


When does the auto update index statistics feature in sql server turn itself on?q) what specific conditions database should meet, before you can bulk copy data into it using bcp?

0 Answers  


What is analysis service repository?

0 Answers  


What is the importance of a recovery model?

0 Answers  


WHAT IS TRIGGERS IN SQL? AND WHAT IS THE BENIFIT?

8 Answers  


Can some one please help with a query which will take only max value of a column in a join.

2 Answers  


hi, how to match retrieve the unmatched records from 2 tables in which we dont have any primary key. example : table1 has 1,2,3,4,5 and table2 has 1,2,3,4,5,6,7,8,9,10 and i want the numbers from 6 to 10 to be displayed and should not come as null. i need the numbers. please reply as soon as possible.

4 Answers  


Categories