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 > Insert Error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-06-04, 06:45
skdmdurai skdmdurai is offline
Registered User
 
Join Date: Mar 2004
Posts: 7
Insert Error

Hai,
While Inserting Datetime values into a table i'm getting an error
as "The Syntax of String reprensentation of datetime is incorrect SQLSTATE 220077"
i'm giving the value as ('1980-01-01')
can someone help me in resolving this

Thanks
Durai
Reply With Quote
  #2 (permalink)  
Old 04-06-04, 07:06
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
What is the column type? Please post the exact SQL statement.
__________________
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 04-06-04, 07:08
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Re: Insert Error

What is the type of the column ?

Post the DDL for table and the INSERT Statement

Cheers
Sathyaram

Quote:
Originally posted by skdmdurai
Hai,
While Inserting Datetime values into a table i'm getting an error
as "The Syntax of String reprensentation of datetime is incorrect SQLSTATE 220077"
i'm giving the value as ('1980-01-01')
can someone help me in resolving this

Thanks
Durai
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #4 (permalink)  
Old 04-06-04, 08:23
skdmdurai skdmdurai is offline
Registered User
 
Join Date: Mar 2004
Posts: 7
Hi,
The Field is Date and length of 10.

Durai
Reply With Quote
  #5 (permalink)  
Old 04-06-04, 08:26
skdmdurai skdmdurai is offline
Registered User
 
Join Date: Mar 2004
Posts: 7
Hi,
The Table is already created ,now we want to insert values into it.
i'm giving the following insert statement

Insert into a_tbl (emplid,dob)values('1',1980-02-21')

pls help me in solving this issue

Thanks,
Durai
Reply With Quote
  #6 (permalink)  
Old 04-06-04, 08:33
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
Quote:
Originally posted by skdmdurai
Hi,
The Table is already created ,now we want to insert values into it.
i'm giving the following insert statement

Insert into a_tbl (emplid,dob)values('1',1980-02-21')

pls help me in solving this issue

Thanks,
Durai
Send the output of "describe" for the table... and you're missing an openning quote before 1980.

If it's a TIMESTAMP column, you have to use a full timestamp, to see the format do a VALUES (CURRENT TIMESTAMP).
__________________
--
Jonathan Petruk
DB2 Database Consultant
Reply With Quote
  #7 (permalink)  
Old 04-06-04, 08:39
skdmdurai skdmdurai is offline
Registered User
 
Join Date: Mar 2004
Posts: 7
Missing of the quote was a typing mistake. what is the query to describe a table


Durai
Reply With Quote
  #8 (permalink)  
Old 04-06-04, 08:40
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
Quote:
Originally posted by skdmdurai
Missing of the quote was a typing mistake. what is the query to describe a table


Durai
describe table <tabname>
__________________
--
Jonathan Petruk
DB2 Database Consultant
Reply With Quote
  #9 (permalink)  
Old 04-06-04, 09:16
skdmdurai skdmdurai is offline
Registered User
 
Join Date: Mar 2004
Posts: 7
Quote:
Originally posted by J Petruk
describe table <tabname>
Hi,
find the desc of my table

Column Type Type
name schema name Length Scale Nulls
------------------------------ --------- ------------------ -------- ----- ------
EMPLID SYSIBM VARGRAPHIC 11 0 No
SEX SYSIBM VARGRAPHIC 1 0 No
ADDRESS1 SYSIBM VARGRAPHIC 55 0 No
ADDRESS2 SYSIBM VARGRAPHIC 55 0 No
CITY SYSIBM VARGRAPHIC 30 0 No
STATE SYSIBM VARGRAPHIC 6 0 No
POSTAL SYSIBM VARGRAPHIC 12 0 No
PHONE SYSIBM VARGRAPHIC 24 0 No
DEPEND_BIRTHDATE SYSIBM DATE 4 0 Yes
Reply With Quote
  #10 (permalink)  
Old 04-06-04, 09:30
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
I honestly can't see anything wrong with your INSERT... this is the exact SQL and table definition?

If you're doing this from the command line, can you put the INSERT in quotes?

ie.
db2 "insert into .... values ... "
__________________
--
Jonathan Petruk
DB2 Database Consultant
Reply With Quote
  #11 (permalink)  
Old 04-06-04, 09:51
skdmdurai skdmdurai is offline
Registered User
 
Join Date: Mar 2004
Posts: 7
Hi,
The table is correct.i'm using Quest central for running the db2 statements. the format of the date is correct? what i'm using? i.e 'yyyy-mm-dd'
bcos while running it gives error of sqlstate:220077
i also tried with giving as '1981-01-20.00.00.00'.this is also not taking
kindly help me in solving it

Durai
Reply With Quote
  #12 (permalink)  
Old 04-06-04, 10:00
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
Quote:
Originally posted by skdmdurai
Hi,
The table is correct.i'm using Quest central for running the db2 statements. the format of the date is correct? what i'm using? i.e 'yyyy-mm-dd'
bcos while running it gives error of sqlstate:220077
i also tried with giving as '1981-01-20.00.00.00'.this is also not taking
kindly help me in solving it

Durai
Ahhh, ODBC... that makes a difference.

TIMESTAMP is this:
yyyy-mm-dd hh:mm:ss.nnnnnn

I thought date was just yyyy-mm-dd, but maybe not.
__________________
--
Jonathan Petruk
DB2 Database Consultant
Reply With Quote
  #13 (permalink)  
Old 04-06-04, 10:16
skdmdurai skdmdurai is offline
Registered User
 
Join Date: Mar 2004
Posts: 7
i will have to give may values like '1998-08-20 20:00:00.000000' ?
it is correct
Reply With Quote
  #14 (permalink)  
Old 04-06-04, 10:54
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
Quote:
Originally posted by skdmdurai
i will have to give may values like '1998-08-20 20:00:00.000000' ?
it is correct
Yes, but I think that's only for timestamp.

What do you get back if you do this? That should tell you what format it's using for DATE:
select current date from sysibm.sysdummy1
__________________
--
Jonathan Petruk
DB2 Database Consultant
Reply With Quote
  #15 (permalink)  
Old 04-06-04, 10:56
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
BTW, I'm not an ODBC expert by any stretch, but apparantly it depends on the BIND option that was used for DATETIME.
__________________
--
Jonathan Petruk
DB2 Database Consultant
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