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
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 |
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 |
Answer / guest
Constraint is better in terms of performance for same
operation. Why??
| Is This Answer Correct ? | 0 Yes | 3 No |
after migrating the dts packg to ssis by using migrtn wizrd in 2005. iam not able to open ssis pack and getting error. what r those errors? how to resolve?
Describe in brief system database.
What are the authentication modes in sql server? How can it be changed?
what is an extended stored procedure? : Sql server database administration
How to Run a Query on a Remote SQL Server?
Why is sql server log file full?
How will u test the stroded procedures and functions? difference between SP and Triggers
Explain what is the difference between a local and a global temporary table?
Can we rollback records deleted by a truncate statement?
3 Answers CarrizalSoft Technologies, United Healthcare,
what is maximum size of temp db?
Explain comment on transactions?
What is triggers in ms sql server?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)