473,388 Members | 1,286 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Syntax of the string representation of a datetime value is incorrect SQLSTATE=22007

We are currently switching to DB2/AIX. I am modifying my sqrs to work
on this new platform. (We are currently on Oracle). I am having a
problem with an sqr that has a reference to a variable for a date
field. I have copied that section of the select statement below.

You can see the old code that I used for Oracle--that works
great--which I have commented out and the new line I added just below.

When this sqr runs, it throws the 'Syntax of the string representation
of a datetime value is incorrect' error. That tells me that 'AND
Z.ACCOUNTING_DT = $ACCOUNTING_DT' is obviously wrong, however I don't
know how to fix. This gets even more complicated because what this
sqr does is load data from a .csv file and when it gets to the field
where the date is, we set that to the variable $ACCOUNTING_DT. Oracle
has no problem understanding it, but DB2 does.

Any ideas out there on how I can resolve this?

FROM PS_BI_ACCT_ENTRY Z
WHERE Z.BUSINESS_UNIT = $BUSINESS_UNIT
AND Z.INVOICE = $INVOICE
AND Z.LINE_SEQ_NUM = $LINE_SEQ_NUM
!002237..AND Z.ACCOUNTING_DT = TO_DATE($ACCOUNTING_DT,'YYYY-MM-DD')
AND Z.ACCOUNTING_DT = $ACCOUNTING_DT !002237..
AND Z.ACCT_ENTRY_TYPE = 'RR'
AND Z.DISC_SUR_LVL = 0
AND Z.DISC_SUR_ID = ' '
AND Z.TAX_AUTHORITY_CD = ' '
END-SELECT
Any suggestions would be very much appreciated!

Thanks, Brenda
Nov 12 '05 #1
6 27782

"Brenda" <bl*********@yahoo.com> wrote in message
news:19*************************@posting.google.co m...
We are currently switching to DB2/AIX. I am modifying my sqrs to work
on this new platform. (We are currently on Oracle). I am having a
problem with an sqr that has a reference to a variable for a date
field. I have copied that section of the select statement below.

You can see the old code that I used for Oracle--that works
great--which I have commented out and the new line I added just below.

When this sqr runs, it throws the 'Syntax of the string representation
of a datetime value is incorrect' error. That tells me that 'AND
Z.ACCOUNTING_DT = $ACCOUNTING_DT' is obviously wrong, however I don't
know how to fix. This gets even more complicated because what this
sqr does is load data from a .csv file and when it gets to the field
where the date is, we set that to the variable $ACCOUNTING_DT. Oracle
has no problem understanding it, but DB2 does.

Any ideas out there on how I can resolve this?

FROM PS_BI_ACCT_ENTRY Z
WHERE Z.BUSINESS_UNIT = $BUSINESS_UNIT
AND Z.INVOICE = $INVOICE
AND Z.LINE_SEQ_NUM = $LINE_SEQ_NUM
!002237..AND Z.ACCOUNTING_DT = TO_DATE($ACCOUNTING_DT,'YYYY-MM-DD')
AND Z.ACCOUNTING_DT = $ACCOUNTING_DT !002237..
AND Z.ACCT_ENTRY_TYPE = 'RR'
AND Z.DISC_SUR_LVL = 0
AND Z.DISC_SUR_ID = ' '
AND Z.TAX_AUTHORITY_CD = ' '
END-SELECT
Any suggestions would be very much appreciated!

Thanks, Brenda


What does the data look like on the CSV file for date.
Nov 12 '05 #2
>> Any ideas out there on how I can resolve this? <<

You might want to look at the text file you are importing to see how
it is formatted. Oracle has a different date range than anyone else
and does not default to ISO-8601 formats ('yyyy-mm-dd'). Standard
SQL-92 only allows ISO-8601 temporal data.
Nov 12 '05 #3
jo*******@northface.edu (--CELKO--) wrote in message news:<a2**************************@posting.google. com>...
Any ideas out there on how I can resolve this? <<


You might want to look at the text file you are importing to see how
it is formatted. Oracle has a different date range than anyone else
and does not default to ISO-8601 formats ('yyyy-mm-dd'). Standard
SQL-92 only allows ISO-8601 temporal data.


I checked the csv file and the date is 2003-09-25 which is the correct
format. Do you think it is because when it reads the .csv file I set
that date to a variable ($ACCOUNTING_DT) and it needs me to do
something else to that value when it reads it? I don't know what else
to look at. Any other ideas would be great.

Thanks, Brenda
Nov 12 '05 #4
"Mark A" <ma@switchboard.net> wrote in message news:<PZ***************@news.uswest.net>...
"Brenda" <bl*********@yahoo.com> wrote in message
news:19*************************@posting.google.co m...
We are currently switching to DB2/AIX. I am modifying my sqrs to work
on this new platform. (We are currently on Oracle). I am having a
problem with an sqr that has a reference to a variable for a date
field. I have copied that section of the select statement below.

You can see the old code that I used for Oracle--that works
great--which I have commented out and the new line I added just below.

When this sqr runs, it throws the 'Syntax of the string representation
of a datetime value is incorrect' error. That tells me that 'AND
Z.ACCOUNTING_DT = $ACCOUNTING_DT' is obviously wrong, however I don't
know how to fix. This gets even more complicated because what this
sqr does is load data from a .csv file and when it gets to the field
where the date is, we set that to the variable $ACCOUNTING_DT. Oracle
has no problem understanding it, but DB2 does.

Any ideas out there on how I can resolve this?

FROM PS_BI_ACCT_ENTRY Z
WHERE Z.BUSINESS_UNIT = $BUSINESS_UNIT
AND Z.INVOICE = $INVOICE
AND Z.LINE_SEQ_NUM = $LINE_SEQ_NUM
!002237..AND Z.ACCOUNTING_DT = TO_DATE($ACCOUNTING_DT,'YYYY-MM-DD')
AND Z.ACCOUNTING_DT = $ACCOUNTING_DT !002237..
AND Z.ACCT_ENTRY_TYPE = 'RR'
AND Z.DISC_SUR_LVL = 0
AND Z.DISC_SUR_ID = ' '
AND Z.TAX_AUTHORITY_CD = ' '
END-SELECT
Any suggestions would be very much appreciated!

Thanks, Brenda


What does the data look like on the CSV file for date.

I checked the csv file and the date is 2003-09-25 which is the correct
format. Do you think it is because when it reads the .csv file I set
that date to a variable ($ACCOUNTING_DT) and it needs me to do
something else to that value when it reads it? I don't know what else
to look at. Any other ideas would be great.

Thanks, Brenda
Nov 12 '05 #5
"Brenda" <bl*********@yahoo.com> wrote in message
news:19*************************@posting.google.co m...
I checked the csv file and the date is 2003-09-25 which is the correct
format. Do you think it is because when it reads the .csv file I set
that date to a variable ($ACCOUNTING_DT) and it needs me to do
something else to that value when it reads it? I don't know what else
to look at. Any other ideas would be great.

Thanks, Brenda


I believe the value needs to have single quotes around it like:
'2003-09-25'
Nov 12 '05 #6
"Mark A" <ma@switchboard.net> wrote in message news:<aG******************@news.uswest.net>...
"Brenda" <bl*********@yahoo.com> wrote in message
news:19*************************@posting.google.co m...
I checked the csv file and the date is 2003-09-25 which is the correct
format. Do you think it is because when it reads the .csv file I set
that date to a variable ($ACCOUNTING_DT) and it needs me to do
something else to that value when it reads it? I don't know what else
to look at. Any other ideas would be great.

Thanks, Brenda


I believe the value needs to have single quotes around it like:
'2003-09-25'


I contacted our DBA this morning and that was her solution also. We
tried changing the csv to '2003-09-25' for that field and it didn't
work--still getting the same error. Any other thoughts?

Thanks, Brenda
Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tatiana Zadiraka | last post by:
Here is what I get from CLP commands db2 => VALUES date('20-12-2003') SQL0181N The string representation of a datetime value is out of range. SQLSTATE=22007 db2 => VALUES date('20.12.2003')...
1
by: sandip | last post by:
Hi all, I am trying to load data from a Sybase table with 'datetime' column into a DB2 table with 'Date' type column? I used the following command : db2 "IMPORT FROM tabname.dat OF DEL...
8
by: Bob Stearns | last post by:
My client wants to disallow a birth date in the future. First I tried the obvious: ALTER TABLE IS3.ANIMALS ADD CONSTRAINT b_d_f CHECK (birth_date<=current_date) It failed because special...
5
by: Serge Rielau | last post by:
I figure someone else may have use for this toy, so here goes: Prereq: DB2 V8.1 FP4 CREATE PROCEDURE DELETE_MANY_ROWS (tabschema VARCHAR(128), tabname VARCHAR(128), predicate VARCHAR(1000),...
10
by: satishrajana | last post by:
Hi, My SQL returns a NULL in a datefield if there is no date in that field. If there is a NULL in this column, I want to replace it with spaces in my SELECT statement when I am selecting these...
2
by: klaus.schu | last post by:
I just receive an error during my CLI ODBC insert statement: INSERT INTO (.....) VALUES (?, ?, ?, TIMESTAMP( CAST(? AS VARCHAR(10)),'00:00:00'), ?, ?, ?, ?)"; the ? in the CAST( ) Statement is...
0
by: Dagmar Zahorska | last post by:
Hi, Could you pls. advice me how to get rid of this error? I query a table with date formats 'yyyy-mm-dd' originally. In detail view of the table in query section I see the date format is...
1
by: Dobber | last post by:
I am trying to construct an SQL statment and pass it to an i5. However I keep getting the above error message. At its simplest I am trying to convert an 8 0 numeric field in the format 20070817 to a...
5
by: Ty | last post by:
Syntax Error-Help!! My error "SQL0180N The syntax of the string representation of a datetime value is incorrect. SQLSTATE=22007" . I'm using yyyy-mm-dd. I can see the dates in a column on...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.