ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Current Timestamp esql is producing an &apos - Failing

Post new topic  Reply to topic
 Current Timestamp esql is producing an &apos - Failing « View previous topic :: View next topic » 
Author Message
rharikumar
PostPosted: Mon Oct 14, 2013 5:21 am    Post subject: Current Timestamp esql is producing an &apos - Failing Reply with quote

Novice

Joined: 14 Oct 2013
Posts: 16

Hi

I am using current timestamp for a variable . But in certain scenarios , i am getting a value as below , which is failing in the target system .

2013-10-08T10:48:11.374'

Does anyone have any idea about such a scenario with timestamp ??


Code Snippet :

SUBSTRING(REPLACE(REPLACE(CAST(CURRENT_GMTTIMESTAMP AS CHARACTER),' ','T'),'GMTTIMESTAMPT','')FROM 2 FOR 26);
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Mon Oct 14, 2013 5:28 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Your code fails to make use of the FORMAT clause. The InfoCentre has explicit examples about how to format time and date strings. Have you read those ?
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
McueMart
PostPosted: Mon Oct 14, 2013 6:17 am    Post subject: Reply with quote

Chevalier

Joined: 29 Nov 2011
Posts: 490
Location: UK...somewhere

The root cause is because normally CURRENT_TIMESTAMP will return in the format: 2006-02-01 13:13:56.444730 , but if the trailing microseconds are all 0's e.g. 2006-02-01 13:13:56.444000, it will actually return as 2006-02-01 13:13:56.444. This means that when you do your SUBSTRING, you are getting one of the apostrophes.

As lancelotlinc pointed out, you might want to look at the format options to avoid this issue and the horrible code you currently have in place.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Mon Oct 14, 2013 6:25 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

McueMart wrote:


As lancelotlinc pointed out, you might want to look at the format options to avoid this issue and the horrible code you currently have in place.



_________________
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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Current Timestamp esql is producing an &apos - Failing
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.