View previous topic :: View next topic
|
Author |
Message |
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
Hi,
When I am trying to extract rows from a table based on the DATE (VARDATE is the column name), I am getting an error in which it is giving the display as "
A character field failed conversion to numeric field
I am using the query:
SELECT * FROM <table name>
WHERE VARDATE IN ('12/1/2006')
Please help me out regarding the same. |
|
Back to top |
|
|
twissi
Active User
Joined: 01 Aug 2005 Posts: 105 Location: Somerset, NJ
|
|
|
|
Swapadeep,
What's the type of VARDATE? Maybe it was a DECIMAL type field (of course with no date separators) which doesn't require quotes.
Cheers, T. |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
Last I checked, DB2 date formats are 2006-12-01 |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
stodolas wrote: |
Last I checked, DB2 date formats are 2006-12-01 |
The default string version of a date is yyyy-mm-dd but DB2 will accept dates in other formats. Is the select * from actually a select into? If it is then the format of one of the host variables is incorrect. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Did you post the entire query?
Is this query being run in a program, spufi, or somewhere else?
What sql return code did you get? If you post any and all diagnostic the system provided it may help.
If you copy/paste it is usually faster and more readable. |
|
Back to top |
|
|
twissi
Active User
Joined: 01 Aug 2005 Posts: 105 Location: Somerset, NJ
|
|
|
|
Swapnadeep,
Use '-' (hyphen) as the date separatro and see it works..! |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
twissi wrote: |
Swapnadeep,
Use '-' (hyphen) as the date separatro and see it works..! |
If the date is formatted as yyyy-mm-dd then the '-' is the correct separator but for mm/dd/yyyy you have to use '/'. |
|
Back to top |
|
|
|