Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

How to set database to be read_only in ms sql server?

0 Answers  


How will you collect the date from current date to last older 6 days date in sql server 2005

4 Answers  


What gets stored inside msdb database?

0 Answers   Abacus,


what is meant by deafult in sql server?

2 Answers  


How you would rewrite the sql query to return the customerid sorted numerically?

0 Answers  


What is the maximum number of index per table?

0 Answers  


I am Having tables T1 and T2 both having same data how to check (or) compare the data in both table are same?

3 Answers  


What is sparse columns of sql server 2008?

0 Answers  


What is deadlock and how to avoid the deadlocks.

3 Answers   TCS, Wipro,


How can I know what query is executing by by a particural user? (using sp id or any othe way.)

2 Answers  


How do I find the query plan in sql server?

0 Answers  


What is user-defined functions? What are the types of user-defined functions that can be created?

0 Answers  


Categories