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 > DB2 Timestamp question?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-19-09, 12:00
sgogula sgogula is offline
Registered User
 
Join Date: May 2009
Posts: 7
DB2 Timestamp question?

I am moving data from one table to another table using the below query:

insert into tableA_Archive(Id, request_time) select id, request_time from tableA.

I get the below error when i run the above query:

com.ibm.db2.jcc.a.in: Value "2009-05-19-10.15.14.918826" is too long.. SQLCODE=-433, SQLSTATE=22001, DRIVER=3.52.90

On both the tables request_time is timestamp. How do i insert timestamp from one table to another table?
Reply With Quote
  #2 (permalink)  
Old 05-19-09, 14:19
norbertogf norbertogf is offline
Registered User
 
Join Date: Oct 2003
Location: Curitiba - PR - Brazil
Posts: 17
Are you really sure your columns have the same data type?
If you didn't do it yet, please issue a describe table for each table.

Are those tables in the same physical database, or are they in federated databases?
__________________
Norberto Gasparotto Filho

IBM Cert. DB2 v9 DBA
IBM Cert. DB2 v9 App. Developer
SCJP 5
Reply With Quote
  #3 (permalink)  
Old 05-21-09, 10:51
sgogula sgogula is offline
Registered User
 
Join Date: May 2009
Posts: 7
Quote:
Originally Posted by norbertogf
Are you really sure your columns have the same data type?
If you didn't do it yet, please issue a describe table for each table.

Are those tables in the same physical database, or are they in federated databases?
they are within the same physical database. columns are same as i created the second table by importing the first database columns.

this is the table structure, exactly same in both tables
Code:
 CREATE TABLE "ADMUSR"."BUILD_REQUEST_TEMP" (
		"BUILD_ID" INTEGER NOT NULL,
		"APPLICATION_ID" VARCHAR(10) NOT NULL,
		"REQUEST_TIME" TIMESTAMP NOT NULL,
		"BUILD_END_TIME" TIMESTAMP,
		"BUILD_REQUEST_TIME" TIMESTAMP,
		"BUILD_START_TIME" TIMESTAMP,
		"BUILD_STATUS" VARCHAR(10),
		"DEPLOY_START_TIME" TIMESTAMP,
		"DEPLOY_STATUS" VARCHAR(10),
	)
	DATA CAPTURE NONE 
	IN "USERSPACE1";
Reply With Quote
  #4 (permalink)  
Old 05-21-09, 11:03
rahul_s80 rahul_s80 is offline
Registered User
 
Join Date: Jul 2006
Location: Pune , India
Posts: 433
Strange ! which tool you are using that is giving this error ?
Also can you post the DDL of the other table too and the exact Ins stmy you are firing
__________________
Rahul Singh
Certified DB2 9 DBA / Application Developer
Reply With Quote
  #5 (permalink)  
Old 05-21-09, 11:31
sgogula sgogula is offline
Registered User
 
Join Date: May 2009
Posts: 7
Quote:
Originally Posted by rahul_s80
Strange ! which tool you are using that is giving this error ?
Also can you post the DDL of the other table too and the exact Ins stmy you are firing
I am using IBM Data Studio Developer 1.2.

It is exactly the same as i generated again with the different table name.
Reply With Quote
  #6 (permalink)  
Old 05-21-09, 12:27
Stealth_DBA Stealth_DBA is offline
Registered User
 
Join Date: May 2009
Posts: 472
sgogula, I noticed that the first 3 columns are defined as NOT NULL but your Insert statement is only supplying 2 columns.

Is one of the 2 columns an Identity column (or other type that DB2 will generate)? If not, the Insert needs 3 columns (minimum) to insert into the table.
Reply With Quote
  #7 (permalink)  
Old 05-21-09, 12:27
rdutton rdutton is offline
Registered User
 
Join Date: Dec 2008
Posts: 76
I don't use Data Studio, but I believe it is written in Java. Java only handles the first 3 digits of the microseconds. Maybe that is what it is "too long". Just a guess.
Reply With Quote
  #8 (permalink)  
Old 05-21-09, 12:54
nidm nidm is offline
Registered User
 
Join Date: May 2003
Posts: 113
Quote:
Originally Posted by rdutton
I don't use Data Studio, but I believe it is written in Java. Java only handles the first 3 digits of the microseconds. Maybe that is what it is "too long". Just a guess.
first, I don't think there is anything related with Java or any application. Because the INSERT (with subselect) stmt is totally operated inside DB2.

2nd, someone mention the NULL definition maybe a clue here.
Reply With Quote
  #9 (permalink)  
Old 05-21-09, 12:56
sgogula sgogula is offline
Registered User
 
Join Date: May 2009
Posts: 7
Thanks for all your help. It worked now, i do not know what was the mistake i was making..

this is the working query

Code:
 

INSERT INTO BUILD_REQUEST_ARCHIVE (BUILD_ID, APPLICATION_ID, REQUEST_TIME,
  BUILD_END_TIME, BUILD_REQUEST_TIME, BUILD_START_TIME, BUILD_STATUS,
  DEPLOY_START_TIME, DEPLOY_STATUS)
  SELECT BUILD_ID, APPLICATION_ID, REQUEST_TIME, BUILD_END_TIME,
  BUILD_REQUEST_TIME, BUILD_START_TIME, BUILD_STATUS, DEPLOY_START_TIME,
  DEPLOY_STATUS
    FROM BUILD_REQUEST_TEMP
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