|
SQL error -171 means "The SQL statement includes an unknown
scalar function." Without seeing your query, I cannot tell what
you did wrong. But never mind. I think the following will do it:
select year(thedate)
, dayofyear(thedate)
from yourtable
YEAR() and DAYOFYEAR() are DB2 scalar functions which return
integers for the year and day of year (1-366), respectively.
The day of year between 1 and 366 is what most people mean
when they use the term "Julian."
If, instead of integers, you wanted a YYYYDDD string, you could
use the CAST function:
select cast( year(thedate) * 1000
+ dayofyear(thedate) as char(7) )
from yourtable
For More Information
|