ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Databases  >>  SQL Server
 
 


 

 
 Oracle interview questions  Oracle Interview Questions
 SQL Server interview questions  SQL Server Interview Questions
 MS Access interview questions  MS Access Interview Questions
 MySQL interview questions  MySQL Interview Questions
 Postgre interview questions  Postgre Interview Questions
 Sybase interview questions  Sybase Interview Questions
 DB Architecture interview questions  DB Architecture Interview Questions
 DB Administration interview questions  DB Administration Interview Questions
 DB Development interview questions  DB Development Interview Questions
 SQL PLSQL interview questions  SQL PLSQL Interview Questions
 Databases AllOther interview questions  Databases AllOther Interview Questions
Question
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?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 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
# 1
Constraint is better in terms of performance for same 
operation. Why??
 
Is This Answer Correct ?    0 Yes 0 No
Guest
 
  Re: 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
# 2
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 ?    0 Yes 0 No
Jerry Joseph
 
 
 
  Re: 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
# 3
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 ?    1 Yes 0 No
Monal
 

 
 
 
Other SQL Server Interview Questions
 
  Question Asked @ Answers
 
Let us say the SQL Server crashed and you are rebuilding the databases including the master database what procedure to you follow?  2
What is the difference between views and stored procedures? Can we have input parameters for views?  3
Is it possible to allow NULL values in foreign key? I s it possible to use different constraints for the same column in the table (i.e) (id int NOT NULL,UNIQUEUE)  1
What are the different types of replication? How are they used?  3
write down the sql query? Table Name : emp1 empid empname 1 bala 2 guna Table Name : emp2 empid empname 1 <Null> 2 <Null> Solution : emp1 names are updated in emp2, write a query?  3
How do you know which index a table is using?  4
Wht is SQL Injection Attack ?  1
how to connect sybase to sql server 2005?. ABC1
What is the difference between Drop and Truncate  7
explain different types of jions with examples briefly? Zensar3
Explain basic SQL queries with SELECT from where Order By, Group By-Having? Wipro1
What are the steps you will take to improve performance of a poor performing query? HCL1
Let us say master db itself has no backup. Now you have to rebuild the db so what kind of action do you take?  1
Accidentally i deleted my table. How can i get that table?  2
How do you measure the performance of a stored procedure? Infosys1
Can you tell me the difference between DELETE & TRUNCATE commands?  10
can you any body tell me the how to decrease the logfile  2
how to know Who Is Blocking Your SQL Server?  2
What is a trigger?  6
What is the appropriate number of test cases that you can write on a database? Microsoft1
 
For more SQL Server Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com