O'Reilly logo

SAP Data Services 4.x Cookbook by Ivan Shomnikov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using conversion functions

Conversion functions allow you to change the data type of the variable or column data type in the Query transform from one to another. This is very handy, for example, when you receive date values as string characters and want to convert them to internal date data types to apply date functions or perform arithmetic operations on them.

How to do it…

One of the most used functions to convert from one data type to another is the cast() function. Look at the examples here. As usual, create a new job with an empty script object and type this code in it. Create a $l_varchar job local variable of the varchar(10) data type:

$l_varchar = '20150507'; # Casting varchar to integer print( cast($l_varchar,'integer') ); # Casting varchar ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required