Archives of the TeradataForum
Message Posted: Tue, 29 Jan 2008 @ 18:13:25 GMT
Subj: | | Re: Convert time from twenty four hour to twelve hour format |
|
From: | | Pugliesi, Anthony J |
The data going into the format statement is not in the correct form. You will get the same error if you run this:
sel extract(month from current_timestamp) (format '99')
, cast(extract(month from current_timestamp)
as char(2) ) (format '99') charmonth
The second column errors out because the cast statement has changed the number produced by the extract to characters yielding '1 ' if
executed today. Remove the format statement from the second column and the statement executes. By the way the format statement does NOT produce
the same results, at least visually, in SQL Assistant as it does in BTEQ. However I believe you will get the same error in BTEQ.
You will probably need to do something a little more complicated than a simple format and cast to arrive at you solution.
Good luck,
Tony
|