IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Check Constraint


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Siddharth Bahirsheth

New User


Joined: 23 Jul 2007
Posts: 16
Location: Mumbai

PostPosted: Tue Oct 21, 2008 12:48 pm
Reply with quote

I want add a check constraint to a column during create table query,to start that column by digit 9 and should range between 9000000000 and 9999999999 only.
How to go about it .Please provide me with query

P.S: Is there any data type to accept only number(13 digits) ,apart from smallint ,int and dec(13,0) .

Thanks in advance.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Tue Oct 21, 2008 3:05 pm
Reply with quote

Hello Siddharth,

You can use below query or this

CREATE TABLE EMPSAL
(ID INTEGER NOT NULL,
SALARY INTEGER CHECK (SALARY >= 9000000000
AND SALARY <= 9999999999));
Back to top
View user's profile Send private message
Siddharth Bahirsheth

New User


Joined: 23 Jul 2007
Posts: 16
Location: Mumbai

PostPosted: Tue Oct 21, 2008 5:15 pm
Reply with quote

Thanks for the reply guptae,But only the part of query is been responded ,request you to answer the rest as well.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts How to check whether who renamed the ... JCL & VSAM 3
No new posts No ++JCLIN, APPLY CHECK job JCL & VSAM 1
No new posts EMPTY file check scenario JCL & VSAM 6
Search our Forums:

Back to Top