ButtonMoon
Registered User.
- Local time
- Today, 15:00
- Joined
- Jun 4, 2012
- Messages
- 305
That's an important issue: data integrity in the application vs data integrity in the database itself.I've read that the validation rule is better managed at the Form level on the "Before Update" field, I'm currently managing it directly on the table in the field property. What should I use?
Putting data integrity rules into the database usually has many advantages over doing it in the application. Putting data integrity in the database means you have just one place to maintain the constraints so you don't have to update and keep every form and application in sync. An event-driven validation in procedural code is not equivalent to a database constraint. The event-driven code only checks the data from the point at which the code was created and in effect. Looking at the data a year or two later you may not even know whether and when the event-driven validations were effective or whether they applied to all data in a table. The constraint guarantees that all the data in the tables complies, no matter when it was entered.
Constraints are also available to the query optimizer to enable query rewrites; application-level validation code is not and cannot be used that way.
My advice would be to put data integrity into the database as constraints whenever practical but whether you do or not, at least give some thought to some of the points I've mentioned.
Hope this helps.