1

I have a column of varchar2(30) with not null and check constraint.

My problem is, I want that column to accept only caps A to caps Z only by using check constraint. How do I do this?

1
  • 1
    What RDBMS and version are you using? SQL Server? Oracle? MySQL? Something else? Commented Aug 18, 2012 at 14:35

1 Answer 1

2
CONSTRAINT check_column_name CHECK (REGEXP_LIKE(column-name, '^[A-Z]+$')); 

Here's an sqlfiddle exemplifying it.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.