0

How to write new column with check constraint to allow only values Y, N ?

Mureinik
  • 297,002
  • 52
  • 306
  • 350

1 Answers1

2

An alter table statement should do it:

ALTER TABLE mytable
ADD newcolumn CHAR(1) NOT NULL DEFAULT 'N' CHECK (newcolumn IN ('Y', 'N'))
Mureinik
  • 297,002
  • 52
  • 306
  • 350