You could create a check constraint on the column and later when you need
to modify it just drop it and recreate it with the additional values.
CREATE TABLE test
(VALUE1 INTEGER NOT NULL CONSTRAINT VALUEx CHECK(VALUE1=1
OR VALUE1=2) )
Jamil Abu-Shaikha
|---------+--------------------------------------------------------->
| | "Pedro Miguel Gonçalves " |
| | <db2udbdba-ezmlmshield-x73893162.[Email Address Removed] | azyDBA.com> |
| | |
| | 09/27/2005 11:36 AM |
| | |
|---------+--------------------------------------------------------->
>----------------------------------------------------------------------------------------------|
| |
| To: "LazyDBA Discussion" <[Email address protected] |
| cc: |
| Subject: Restrict values in an INTEGER column. |
>----------------------------------------------------------------------------------------------|
Hi Guys,
Currently working in DB2 v.7 fro Z/Os
I have 2 questions:
1st question:
==========
I need a table that will contain a column data-typed=INTEGER and that wil
restrict its update or insert only with the values 1 and 2.
Is that possible, I think so.
Please tell me how to code that in my table.
2nd question:
==========
If later I would want to ALTER the restriction on that same column to the
values 1,2 and 3?
That would make me drop a recreate my table? Or there's a way just ALTERing
the column and REORG?
Please tell me how to code that in my table too.
Thanks in advance,
---------------------------------------------------------------------
PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
website: http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
********************************************************************************
Unauthorized interception of this communication could be a
violation of Federal and State Law. This communication and
any files transmitted with it are confidential and may contain
protected health information. This communication is solely
for the use of the person or entity to whom it was addressed.
If you are not the intended recipient, any use, distribution,
printing or acting in reliance on the contents of this message
is strictly prohibited. If you have received this message
in error, please notify the sender and destroy any and all copies.
Thank you.
*******************************************************************************
DB2 & UDB email list listserv db2-l LazyDBA home page