DB02003: Constraint Violation
What This Means
The data you're trying to save violates database rules. Constraints ensure data integrity by enforcing rules about what data can be stored.
Common Causes
- Missing required data — A required field is empty
- Invalid relationship — Referencing a record that doesn't exist
- Data type mismatch — Wrong type of data for the field
- Value out of range — Number exceeds allowed limits
How to Fix
1. Check Required Fields
Ensure all required data is provided:
- Customer information (if required)
- Product details
- Order line items
2. Verify References
If the error involves relationships:
- Ensure referenced products exist
- Check that customer IDs are valid
- Verify category assignments
3. Review Data Values
Check for invalid values:
- Negative quantities where not allowed
- Prices exceeding limits
- Invalid status values
4. Sync Latest Data
The referenced data may be out of sync:
- Refresh data from server
- Wait for sync to complete
- Retry the operation
5. Clear and Retry
If data is corrupted:
- Clear the problematic form
- Re-enter the data
- Submit again
Common Constraint Examples
- Quantity must be positive — Can't add 0 or negative items
- Price must be numeric — Text not allowed in price fields
- Customer must exist — Can't assign order to non-existent customer