Author |
Message
|
balu2608 |
Posted: Sat Jan 12, 2013 1:19 am Post subject: DATE TYPE |
|
|
 Apprentice
Joined: 18 May 2012 Posts: 39
|
Hi All,
Can anyone suggest me how can we convert STRING type to DATE Type in esql.... |
|
Back to top |
|
 |
smdavies99 |
Posted: Sat Jan 12, 2013 1:49 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
How are you trying to do it?
If you have, what errors have you encountered?
It really does help us to know all the facts (such as those above). _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
visasimbu |
Posted: Sat Jan 12, 2013 2:09 am Post subject: |
|
|
 Disciple
Joined: 06 Nov 2009 Posts: 171
|
Check the link
or the code
Code: |
DECLARE source CHARACTER '01-02-03';
DECLARE target DATE;
DECLARE pattern CHARACTER 'dd-MM-yy';
SET target = CAST(source AS DATE FORMAT pattern);
-- target now contains Year=2003, Month=02, Day=01
|
Last edited by visasimbu on Sat Jan 12, 2013 8:46 am; edited 2 times in total |
|
Back to top |
|
 |
balu2608 |
Posted: Sat Jan 12, 2013 4:06 am Post subject: DECLARE source CHARACTER '01-02-03'; |
|
|
 Apprentice
Joined: 18 May 2012 Posts: 39
|
Hi Visa,
Even iam trying in the same method but its throwing an eror has invalid data type.. |
|
Back to top |
|
 |
visasimbu |
Posted: Sat Jan 12, 2013 8:43 am Post subject: Re: DECLARE source CHARACTER '01-02-03'; |
|
|
 Disciple
Joined: 06 Nov 2009 Posts: 171
|
balu2608 wrote: |
Even iam trying in the same method but its throwing an eror has invalid data type.. |
What you have written in your esql code ?
Place the full exception here..
or
If you place the trace, it gives more detailed explanation of the error.
Call me Simbu.  |
|
Back to top |
|
 |
mqjeff |
Posted: Sat Jan 12, 2013 9:31 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Hi 2608 -
You spend a lot of time here asking for basic and simple help.
It must be very frustrating for you.
In my long career, I have found a simple way to relieve that kind of frustration.
I repeated beat my head against the documentation, in a metaphoric sense these days now that it's all electronic and not printed. Eventually, the documentation starts to sink in and make sense.
I augment this daily ritual of relieving frustration by trying things that immediately fail. Then I waste a lot of time trying to make them work, which generates more frustration.
Eventually this cycle of frustration relieved by self-punishment via documentation leading to increased frustration from failing to achieve things leads to learning.
And learning leads to success.
I realize this is not a terribly helpful response, and it's not a very easy road to follow.
But I can say it has actually worked. |
|
Back to top |
|
 |
rekarm01 |
Posted: Sat Jan 12, 2013 11:33 am Post subject: Re: DECLARE source CHARACTER '01-02-03'; |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
balu2608 wrote: |
Even iam trying in the same method but its throwing an eror has invalid data type. |
Unfortunately, nobody else can see the offending source code, or actual error message.
Posting any relevant details up front, rather than waiting for someone to ask for them, can help resolve the problem more quickly. |
|
Back to top |
|
 |
|