Page 1 of 1

Conversion-Varchar to Integer

Posted: Tue Feb 15, 2005 1:11 am
by suma
Hi
I have some doubts with Date Functions.
Many of the Built-in Date Transforms like TAG.TO.YEAR etc returns varchar.I want to apply some arithmetic functions on these results.
Is there any way to convert these varchar to integer.

Also What do the functions Num,Int Return?

Thanks & Regards
SumA

Posted: Tue Feb 15, 2005 1:53 am
by vigneshra
Hi Suma,

You can very well arithmetic functions as a type conversion will be done implicitly. The function Num(STRING) will return success if the string supplied can be converted to a number. This can be used for validating the string. I don't know if there is a function with name 'int' is there. :roll:

Posted: Tue Feb 15, 2005 1:53 am
by ArndW
Hello SumA,

DataStage will implicitly perform a string-to-integer conversion when you attempt to perform a mathematical operation to a string; in fact this is one of the features that makes DS such a powerful tool. Of course the conversion will have problems if the string doesn't contain a number and you attempt to subtract something from it. In the case of the functions that return a "2005" type year string you can use it as it if were a number.