Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2006
    Posts
    1

    Question Unanswered: Insert DB2 SQL statement for a table with a column having TIMESTAMP as datatype !!

    Hi ,
    this is Satish. I am new to DB2 and new to this group too. I have a very simple question. Please help me.

    I have a table created with the command,

    CRATE TABLE WID
    ( COL1 VARCHAR(30),
    COL2 TIMESTAMP
    )
    IN SIEBELWW.WIDACCNT FOR SBCS DATA;


    Now I want to insert a record into this table. Can anybody please write a SQL statement for this ? This will be a great help. Please help me. The ' TIMESTAMP ' is creating problems for me.

    Thanks a lot in advance.
    Satish

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11

    timestap

    insert into table tt (col1,col2) values ('aa','1988-12-25-17.12.30.000000') ;
    current timestamp can also be used
    insert into table tt (col1,col2) values ('aa',current timestamp) ;
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Jan 2013
    Posts
    10

    default CURRENT TIMESTAMP in DB2

    Hello,

    I have a problem with TIMESTAMP data type too.
    In the Control center, Create Table Wizard, I am trying to add a column which should have as a default value the current timestamp.
    But something goes wrong and I cannot figure it out.
    You can see in the attachements the screenshots of this issue.
    I would apreciate any help, because I have been searching for an answer for two days.
    Thank you!
    Madalina
    Attached Thumbnails Attached Thumbnails addcolumn.png   errormessage.png  

  4. #4
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    current timestamp is a registry and should not be quoted = literal
    just remove the quotes
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  5. #5
    Join Date
    Jan 2013
    Posts
    10
    But how? Because I don't put them there, in the query. They seem to appear automatically.

  6. #6
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    cut the syntax for create table - goto command window /command center and execute the same sql without the quotes
    ps : create table should be a dba job.... and they know how to create tables....or they are presumed to know howto..
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  7. #7
    Join Date
    Jan 2013
    Posts
    10
    Yes, it works in Command Line.
    Thank you so much for your time and promptitude!
    I am new in dba (obviously) and unfortunately there is nobody who can help me (besides the internet).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •