|
Archives of the TeradataForumMessage Posted: Fri, 30 Jun 2006 @ 08:59:45 GMT
Vivek Pandey wrote:
Both versions actually *do* a typecast, but use different rules for it. The manuals are correct, they even talk about those differences: SQL Reference: Functions and Operators Chapter 15: Data Type Conversions Numeric-to-Character Conversion How CAST Differs from Teradata Conversion Syntax In short: Both use the column's FORMAT, but Teradata style casts right-aligned, whereas ANSI casts left-aligned. sel cast(1234567 as char(11)) || ';', (1234567 (char(11))) || ';', (1234567 (char(20))) || ';', (1234567 (char(5))) || ';'; *** Query completed. One row found. 3 columns returned. *** Total elapsed time was 1 second. (1234567||';') (1234567||';') (1234567||';') -------------- -------------- --------------------- 1234567 ; 1234567; 1234567 ; There are lots of possible ways to represent 1 in a string: '1', ' 1', '1 ', '1.0', '1.00', ... That's why it's recommended to cast the char to a numeric value :-) Btw, if you really join int to varchar, then your datamodel is flawed... Dieter
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||