Home » RDBMS Server » Server Administration » check constraint
check constraint [message #374578] Tue, 19 June 2001 15:00 Go to next message
Bonnie Melanson
Messages: 3
Registered: April 2001
Junior Member
I have a check constraint as follows:

check (column_name in ('Y',null))

I only want to allow either null or 'Y' entries, however the database will allow ANY entry. How do I allow only a 'Y' or a null value?????

Thanks!
Re: check constraint [message #374581 is a reply to message #374578] Tue, 19 June 2001 16:54 Go to previous message
Andrew again...
Messages: 270
Registered: July 2000
Senior Member
Actually it's not necessary to specify null as it will be allowed using this: (column_name = 'Y')

for clarity though, I'd change it to indicate the null:
(column_name = 'Y' or column_name is null)

To extend it:
(column_name in ('Y', 'N') or column_name is null)
Previous Topic: Incremental EXPORTS - How to do it.
Next Topic: Child to Parent
Goto Forum:
  


Current Time: Sat Jul 06 08:18:44 CDT 2024