I have a column that appear like this and the data type is integer. I get that data from AS400 server that's why it uses integer data type. The date format is represent as YYYYMMDD
In report studio, I created a data item that would convert this integer column to date time. But it failed.
I have tried lots of different approach but none of these worked.
cast([WCPDOD], 'YYYYMMDD')
cast([WCPDOD], date) UDA-SQL-0219 The function "to_date" is being used for local processing but is not available as a built-in function, or at least one of its parameters is not supported.RSV-SRV-0042
cast([WCPDOD], YYYY-MM-DD)
cast([WCPDOD], datetime)
cast_timestamp([WCPDOD], datetime)
cast_timestamp([WCPDOD], date)
cast_integer([WCPDOD], date)
Can someone help me with this? My goal is to get this 20150729 into this 07/29/2015 at least
First, cast your 10-digit integer into a string:
Data Item2
cast([Data Item1],varchar(10))
Next, use substring to extract out the date components and build a date string:
Data Item3
substring([Data Item2],1,4) + '-' + substring([Data Item2],5,2) + '-' + substring([Data Item2],7,2)
Lastly, convert the resulting string to date format:
Data Item4
cast([Data Item3],date)
Of course, this can all be done in a single expression but I broke it out here for clarity.