All Forums Database
nithin21 2 posts Joined 06/14
29 Oct 2014
Date field behaving different in different environment

Hi,
I have a date column upon casting it shows the result in differnt format in differnt environment.
here is my query.
 
SELECT DT_END_RANGE AS A ,CAST(DT_END_RANGE AS CHAR(10)) AS B , CAST(CAST(DT_END_RANGE AS CHAR(10)) AS DATE) AS C FROM TAB1 WHERE YR=2014
output in 1 environment:
A    B   C
9/16/2014 14/09/16 9/16/1914 

The same query in differnt environment
output in 2 environment:
A    B   C
9/16/2014 2014-09-16 9/16/2014 
 
I hope it is environment issue, but let me know how can we fix this ?

Tags:
Raja_KT 1246 posts Joined 07/09
29 Oct 2014

Even if you choose/set as below?

SET SESSION DATEFORM = ANSIDATE

 

              = INTEGERDATE

 

Raja K Thaw
My wiki: http://en.wikipedia.org/wiki/User:Kt_raj1
Street Children suffer not by their fault. We can help them if we want.

nithin21 2 posts Joined 06/14
29 Oct 2014

Yes , i tried to set session dateform= ANSIDATE and INTEGERDATE

ulrich 816 posts Joined 09/09
29 Oct 2014

which tool do you use to run the query?
you use the same tool for both queries?
run
show your_SQL;
on both environments.
check if the date field contains different format strings in the different environements.

feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

vikas_yadav 19 posts Joined 09/12
29 Oct 2014

you can apply format string in date field.

SELECT current_date  AS A ,CAST(cast(current_date as  date format 'dd/mm/yyyy') AS CHAR(10)) AS B , CAST(CAST(current_date  AS CHAR(10)) AS DATE) AS C ;

 

You must sign in to leave a comment.