|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 7/31/2008 11:36:47 PM
Posts: 2,
Visits: 5
|
|
Hi ,
Below sql giving invalid time stamp .12/31/2007 This is in varchar format 'mm/dd/yyyy'.
I need to convert varchar to date
PERIOD
=======
12/31/2007
SEL cast( cast(BUSINESS_DATE as TIMESTAMP(0) format 'dd-mm-yyyy') AS DATE FORMAT 'YYYY-MM-DD')
from PERIOD
/
Thanks in advance
Mohan
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 6/25/2008 7:26:06 AM
Posts: 474,
Visits: 202
|
|
Hi Mohan,
did you submit that query using SQL Assistant?
This is using the windows locale definition of a date, you have to modify that using:
Tools - Options - General: Display dates in this format
If this isn't a problem related to SQL Assistant, then you have to re-phrase your question, because i didn't catch it...
Dieter
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: Yesterday @ 3:38:19 AM
Posts: 35,
Visits: 243
|
|
Hi Mohan,
I was able to run successfully the below query:
SEL cast( cast(current_date as TIMESTAMP(0) format 'dd-mm-yyyy') AS DATE FORMAT 'YYYY-MM-DD');
Current Date
------------
2008-05-09
I don't see any problem in that.
Regards:
Monika
|
|
|
|
|
Forum Member
      
Group: Forum Members
Last Login: Yesterday @ 3:38:19 AM
Posts: 35,
Visits: 243
|
|
Hi Mohan,
sorry yaar. Plz ignore my pervious reply.
Please store/change the date format to yyyymmdd then do the further processing.
I think it will work. because teradata stores the date in yyyymmdd format.
Please try and let me know too.
Regards:
Monika
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 8/19/2008 12:35:21 PM
Posts: 14,
Visits: 14
|
|
Sounds like business_date is a varchar column, containing a date in the format of 'mm/dd/yyyy'. If so, then I think this would give you what you want (a date data type for this value):
sel business_date (date, format 'mm/dd/yyyy')
from ...
|
|
|
|