Table Create Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spanky1968
    New Member
    • Sep 2007
    • 5

    Table Create Question

    OK, I have an easy one for somebody out there. I am creating a table and I would like to assign one of the fields as the primary key.

    Table create example:
    Code:
    db2 -v "create table temp_table(ID varchar(6), date timestamp(30), acct_total decimal(9), cust_total decimal(9), txn_total decimal(9))"
    I would like to assign the date field as the primary key but I am unsure how to do this, can you help?

    Thanks in advance.
  • sakumar9
    Recognized Expert New Member
    • Jan 2008
    • 127

    #2
    You can try this command:


    Code:
    CREATE TABLE TEMP_TABLE 
      ( ID VARCHAR (10) ,
      DATE TIMESTAMP  NOT NULL , 
      ACCT_TOTAL DECIMAL (5, 0) , 
      CST_TOTAL DECIMAL (5, 0) , 
      TXN_TOTAL DECIMAL (5, 0), 
      CONSTRAINT CC1203569699406 PRIMARY KEY ( DATE)  ) ;

    Regards
    -- Sanjay

    Comment

    • ricka49
      New Member
      • Feb 2008
      • 4

      #3
      Create Table Gwc.cl_clm_fil_ catg_type
      (fil_catg_typcd Char(4) For Sbcs Data Not Null,
      Fil_catg_type_d esc Char(50) For Sbcs Data Not Null,
      Last_chng_useri d Char(8) For Sbcs Data Not Null,
      Last_chng_timst m Timestamp Not Null,
      Constraint Xpkclaim_filing _category_type
      Primary Key (fil_catg_typcd ))
      In Cl.clcattyp
      Audit None
      Data Capture None
      Ccsid Ebcdic
      Not Volatile;

      Comment

      • spanky1968
        New Member
        • Sep 2007
        • 5

        #4
        Thank you it worked great.

        Comment

        Working...