Hi
This might be an obvious question to some of you, but I'm stumped and any help would be appreciated! I used to work in SQL Server, and am new to Teradata SQL. I'm not sure if this query is not working because of limitation differences between the two, or if it is a pure SQL problem. (Seeing how I couldn't find a teradata forum, I posted this problem here).
This is an excerpt of a query I'm trying to run in Teradata SQL Assistant:
SELECT
'TYLastRollUpCompWSSI' as WSSISet,
'FcastClosing Stock' as Measure,
sum(ZEROIFNULL(a.CCP_Closing_Stk_SV)) as Amt
FROM VWI0GPP_WKLY_SGRP_RPAS_PLAN a
In the resultset, however, the fixed text 'FcastClosing Stock' is being truncated to just 10 characters (i.e. 'FcastClosi) and the fixed text 'TYLastRollUpCompWSSI' is being truncated to just 20 characters (i.e. 'TYLastRollUpCompW').
It might seem silly that I need this ridiculously long names in the first place, but my resultset needs to conform with what is currently in the table.OK ... I managed to come up with a solution that seems to work: I have used "cast" in the select:
SELECT
cast('TYLastRollUpCompWSSI' as CHAR(30)) as WSSISet,
cast('FcastClosing Stock' AS CHAR(25)) as Measure, ... etc.
没有评论:
发表评论