Archives of the TeradataForum
Message Posted: Wed, 14 Nov 2001 @ 20:23:49 GMT
I'm doing some work with Teradata and I don't know a lot about the sql syntax, perhaps you guys could help me out.
1. create table TABLESOURCE with one column ID in DECIMAL(18,0)
2. create table TABLETARGET with one column ID in CHARACTER(255)
3. insert some values in TABLE_SOURCE like 7519,0,-1,13
4. I want to transfer these values from TABLESOURCE to TABLE_TARGET and I use this sql statement:
insert into TABLETARGET (ID) select trim(leading ('0') from ID(format'9(18)')(char(255))) from TABLESOURCE
The syntax trim(leading ('0') from ...) is to truncate all zeros on the left side of the value. Apparently the values 7519 and 13 have been converted correctly but 0 and -1 become ' ' (nothing) and 1
Does anybody know other sql statement to get all values correctly?.
thank you in advance
|Copyright 2016 - All Rights Reserved|
|Last Modified: 27 Dec 2016|