nerdexam
Microsoft

70-465 · Question #113

You need to validate rows before they are added to a table every time a row is added using a user-defined function. What should you use? More than one answer may achieve the goal. Select the BEST…

The correct answer is D. CHECK constraint. To validate rows before insertion using a user-defined function, a CHECK constraint is the most appropriate and direct mechanism, as it can reference scalar UDFs to enforce complex business rules at the column or table level.

Submitted by yousef_jo· Mar 5, 2026Design and implement database solutions for SQL Server

Question

You need to validate rows before they are added to a table every time a row is added using a user-defined function. What should you use? More than one answer may achieve the goal. Select the BEST answer.

Options

  • ADML Trigger
  • BDefault constraint
  • CForeign key
  • DCHECK constraint

How the community answered

(45 responses)
  • A
    4% (2)
  • C
    2% (1)
  • D
    93% (42)

Why each option

To validate rows before insertion using a user-defined function, a CHECK constraint is the most appropriate and direct mechanism, as it can reference scalar UDFs to enforce complex business rules at the column or table level.

ADML Trigger

While a DML Trigger (AFTER or INSTEAD OF) can also invoke a UDF for validation, it is a more complex, procedural solution and is not considered the 'best' answer when a simpler declarative CHECK constraint achieves the same goal.

BDefault constraint

A Default constraint only supplies a value for a column when no value is provided during INSERT; it does not validate or reject rows based on any condition or user-defined function.

CForeign key

A Foreign key constraint enforces referential integrity by ensuring a column's value exists in a referenced parent table; it does not support calling a user-defined function for custom validation logic.

DCHECK constraintCorrect

A CHECK constraint can call a user-defined function to evaluate an expression and reject any INSERT (or UPDATE) that causes the expression to return FALSE or UNKNOWN, making it the ideal declarative mechanism for row validation. It fires automatically on every INSERT and UPDATE, enforcing the rule at the table level without requiring additional procedural code. This is the most direct and standard SQL Server feature designed specifically for this validation scenario.

Concept tested: CHECK constraint with user-defined function for row validation

Source: https://learn.microsoft.com/en-us/sql/relational-databases/tables/unique-constraints-and-check-constraints?view=sql-server-ver16

Topics

#CHECK constraint#Data validation#Data integrity

Community Discussion

No community discussion yet for this question.

Full 70-465 Practice