Archives of the TeradataForum
Message Posted: Fri, 25 Jan 2008 @ 08:51:46 GMT
When using Teradata to create this table and using a date, format is actually the way you should be going:
ct testtbl2 as (sel date (format 'yyyy')(char(4)) a ,date (format 'mm')(char(2)) b ,date (format 'dd')(char(2)) c) with data primary index (a)
This will provide the leading zeroes and you don't need to CAST it because the char specification changes the data type. You would not need the char if any other data type for these values. Since your table at the end of your posting used yearid as a smallint, however, then you would need to use a format in the select to get the leading zeroes since they are normally suppressed.
|Copyright 2016 - All Rights Reserved|
|Last Modified: 27 Dec 2016|