MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Table Definition

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
eskaysem
Beginner


Joined: 31 Mar 2003
Posts: 29
Topics: 13

PostPosted: Wed Jan 25, 2006 6:24 pm    Post subject: Table Definition Reply with quote

Hello,
I was browsing through a table definition and I found the following field which I could not interpret. Could you please let me know what does "DEF" means in the data dictionary?

Column Name Col No Col Type Length Scale Null Def

I'm using DB2 8.1 ver on OS390.

Appreciate your help.
Thanks
Santosh
_________________
Thanks!,
Santosh Kulkarni
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Wed Jan 25, 2006 10:29 pm    Post subject: Reply with quote

Santosh,

If we had table declaration like below:

Code:

CREATE TABLE SHEKAREMP                                               
      (EMPNO                  CHAR(6)           NOT NULL,             
       FIRSTNAME              VARCHAR(12)       NOT NULL,             
       MIDINIT                CHAR(1)           NOT NULL,             
       LASTNAME               VARCHAR(15)       NOT NULL,             
       WORKDEPT               CHAR(3)                   ,             
       PHONENO                CHAR(8)           CONSTRAINT NUMBER CHECK
                              (PHONENO >= '00000000' AND               
                               PHONENO <= '99999999')   ,             
       HIREDATE               DATE                      ,             
       JOB                    CHAR(8)                   ,             
       EDLEVEL                SMALLINT                  ,             
       GENDER                 CHAR(1)                   ,             
       BIRTHDATE              DATE                      ,             
       SALARY                 DECIMAL(9,2)              ,             
       BONUS                  DECIMAL(9,2)              ,             
       COMM                   DECIMAL(9,2)              ,             
       PRIMARY KEY            (EMPNO)                   )
       IN DB2DB.DB2TB#


And if we run the query:

Code:

SELECT * FROM SYSIBM.SYSCOLUMNS WHERE TBCREATOR = 'SHEKAR'# 


OUPUT

Code:

---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---
NAME                TBNAME              TBCREATOR   COLNO  COLTYPE   LENGTH   SCALE    NULLS   DEFAULT
---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---
EMPNO               SHEKAREMP           SHEKAR          1  CHAR           6            N       N
FIRSTNAME           SHEKAREMP           SHEKAR          2  VARCHAR       12            N       N
MIDINIT             SHEKAREMP           SHEKAR          3  CHAR           1            N       N
LASTNAME            SHEKAREMP           SHEKAR          4  VARCHAR       15            N       N
WORKDEPT            SHEKAREMP           SHEKAR          5  CHAR           3            Y       Y
PHONENO             SHEKAREMP           SHEKAR          6  CHAR           8            Y       Y
HIREDATE            SHEKAREMP           SHEKAR          7  DATE           4            Y       Y
JOB                 SHEKAREMP           SHEKAR          8  CHAR           8            Y       Y
EDLEVEL             SHEKAREMP           SHEKAR          9  SMALLINT       2            Y       Y
GENDER              SHEKAREMP           SHEKAR         10  CHAR           1            Y       Y
BIRTHDATE           SHEKAREMP           SHEKAR         11  DATE           4            Y       Y
SALARY              SHEKAREMP           SHEKAR         12  DECIMAL        9            Y       Y
BONUS               SHEKAREMP           SHEKAR         13  DECIMAL        9            Y       Y
COMM                SHEKAREMP           SHEKAR         14  DECIMAL        9            Y       Y


DEF means DEFAULT values and here is an explanation for the DEFAULT INDICATOR N & Y and there are many DEFAULT INDICATORS.

Code:

DEFAULT INDICATOR:                                                     
------------------                                                     
N      THE COLUMN HAS NO DEFAULT VALUE.                                 
                                                                       
Y      IF THE NULLS COLUMN IS Y, THE COLUMN HAS A DEFAULT VALUE OF NULL.
       IF THE NULLS COLUMN IS N, THE DEFAULT VALUE DEPENDS ON THE DATA 
       TYPE OF THE COLUMN.                                             
                                                                       
       DATA TYPE                DEFAULT VALUE                           
       ---------                --------------                         
       NUMERIC                  0                                       
       FIXED-LENGTH STRING      BLANKS                                 
       VARYING-LENGTH STRING    A STRING LENGTH OF 0                   
       DATE                     THE CURRENT DATE                       
       TIME                     THE CURRENT TIME                       
       TIMESTAMP                THE CURRENT TIMESTAMP


Hope this helps for your understanding.

Shekar
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Jan 26, 2006 6:16 am    Post subject: Reply with quote

eskaysem,

Check this link which has a detailed explanation of all the DB2 catalog tables.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQH11/D.0?DT=20010718164132

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
eskaysem
Beginner


Joined: 31 Mar 2003
Posts: 29
Topics: 13

PostPosted: Mon Jan 30, 2006 7:32 pm    Post subject: Reply with quote

Thank you. I appreciate your help.
_________________
Thanks!,
Santosh Kulkarni
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group