QuestionQ141

Data and Database Security

Given the following value in a VARCHAR column used to store integer values:

12A

Which of the following is the best way for a DBA to improve the data quality of this column?

  • A Keep the value and change the column to integer.
  • B Correct the value and change it to integer.
  • C Add a check constraint to the column and change it to int.
  • D Keep the column as VARCHAR and correct the value.
Explanation

A column intended to store integers should contain valid numeric values and use an integer datatype. Correcting the invalid value before converting the column prevents the existing nonnumeric data from blocking the conversion and ensures subsequent values are stored as integers.

Community Discussion

No comments yet. Be the first to start the discussion!