We faced this issue while testing our jobs in Datastage 8.5 during TeraData 13 to 14 upgrade.
Explanation: The user tried to assign a longer to a shorter string destination. This error can also occur if the length of one or more range boundaries in a RANGE_N function is a string literal with a length greater than that of the test value.
But the above explanation didnt help us since the sql we are having issue ran successfully in Teradata 13 and more over that sql ran fine on TeraData 14 too but only when we ran it manually using Teradata SQL Assistant.
Problem at our end :
we are storing year as 2014.00 as decimal datatype in a table and then converting it into 2014 as char. we used (cast (Year as char (4)) Year) to convert decimal to char directly. This used to give 2014 as result in Teradata 13 but on Teradata 14 it failed with the above error. But if you change the above as char(5) the sql runs successfully but the result you get is 2014.(dot at the end which we dont want).
so we changed the sql in such a way first we convert decimal to integer and then integer to char as below.
(cast (cast(Year as INTEGER) as CHAR(4) ) Year). This sql ran successfully and gave us the result we expected.
No comments:
Post a Comment