Results 1 to 5 of 5

Thread: Data type

  1. #1
    Join Date
    Aug 2008
    Posts
    10

    Red face Unanswered: Data type

    Hi All,

    Please suggest me, what data type should I type for timeframe col. I've tried time, date, timestamp. None of these worked. It keep saying "SQL0180N The syntax of the string representation of a datetime value is
    incorrect. SQLSTATE=22007 ". Any suggestion would really help.

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Need more information about what you are trying to store in the column.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    What data did you specified for that column?
    DB2 accepts
    'yyyy-mm-dd', 'mm/dd/yyyy', or 'dd.mm.yyyy' for DATE,
    'yyyy-mm-dd-hh.mm.ss.nnnnnn' or 'yyyy-mm-dd hh:mm:ss.nnnnnn' for TIMWSTAMP.
    Please see "String representations of datetime values" in "DB2 SQL Reference Volume 1" for more descriptions.

  4. #4
    Join Date
    Aug 2008
    Posts
    10

    data type

    I am trying to insert "current date" in that column. The column supposed to be "timeframe". I'hv tried all three data type (date, time, timestamp). Nothing is working. It gives error msg the target data is greater than the column specified.

    I am using Db2 V 8.2
    Fixpak 10

  5. #5
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    Code:
    ------------------------------ Commands Entered ------------------------------
    CREATE TABLE Test_date_time_format
    (id INTEGER
    ,timeframe1 DATE
    ,timeframe2 TIME
    ,timeframe3 TIMESTAMP
    );
    ------------------------------------------------------------------------------
    DB20000I  The SQL command completed successfully.
    
    ------------------------------ Commands Entered ------------------------------
    INSERT INTO Test_date_time_format
     VALUES (1, current date, current time, current timestamp);
    ------------------------------------------------------------------------------
    DB20000I  The SQL command completed successfully.
    
    ------------------------------ Commands Entered ------------------------------
    SELECT * FROM Test_date_time_format;
    ------------------------------------------------------------------------------
    
    ID          TIMEFRAME1 TIMEFRAME2 TIMEFRAME3                
    ----------- ---------- ---------- --------------------------
              1 2008-08-25 14:49:38   2008-08-25-14.49.38.339000
    
      1 record(s) selected.

Posting Permissions

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