Book Image

SAP Data Services 4.x Cookbook

Book Image

SAP Data Services 4.x Cookbook

Overview of this book

Want to cost effectively deliver trusted information to all of your crucial business functions? SAP Data Services delivers one enterprise-class solution for data integration, data quality, data profiling, and text data processing. It boosts productivity with a single solution for data quality and data integration. SAP Data Services also enables you to move, improve, govern, and unlock big data. This book will lead you through the SAP Data Services environment to efficiently develop ETL processes. To begin with, you’ll learn to install, configure, and prepare the ETL development environment. You will get familiarized with the concepts of developing ETL processes with SAP Data Services. Starting from smallest unit of work- the data flow, the chapters will lead you to the highest organizational unit—the Data Services job, revealing the advanced techniques of ETL design. You will learn to import XML files by creating and implementing real-time jobs. It will then guide you through the ETL development patterns that enable the most effective performance when extracting, transforming, and loading data. You will also find out how to create validation functions and transforms. Finally, the book will show you the benefits of data quality management with the help of another SAP solution—Information Steward.
Table of Contents (19 chapters)
SAP Data Services 4.x Cookbook
About the Author
About the Reviewers

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 to decimal
print( cast($l_varchar,'decimal(10,0)') );

# Casting integer value to varchar
print( cast(987654321,'varchar'(10)') );

# Casting integer to a double
print( cast($l_varchar,'double') );

The output is shown here:

Remember that the print...