If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Data type

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-24-08, 22:08
yash2400 yash2400 is offline
Registered User
 
Join Date: Aug 2008
Posts: 10
Red face 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.
Reply With Quote
  #2 (permalink)  
Old 08-24-08, 22:17
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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
Reply With Quote
  #3 (permalink)  
Old 08-24-08, 22:22
tonkuma tonkuma is offline
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
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.
Reply With Quote
  #4 (permalink)  
Old 08-24-08, 22:28
yash2400 yash2400 is offline
Registered User
 
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
Reply With Quote
  #5 (permalink)  
Old 08-25-08, 01:50
tonkuma tonkuma is offline
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On