February 06, 2013, 03:32 PM
AnnaRSQL RIGHT FUNCTION USED IN SELECT STATEMENT
Hi, In a flow, I am trying to use RIGHT function in SQL select statement for the source, as:
SELECT
T1.INV_POST_DATE ,
T1.ACTIVITY_DATE ,
RIGHT(RTRIM(T1.SENDER_ID ), 3) AS TEST,
T1.STORE_NUMBER
FROM
nwest_daily_inv T1
However, Data Migrator throws an error: (FOC14069) SQL SYNTAX ERROR ON LINE 14 AT '('
Interestingly enough, there is no line 14 in that select statement.
The above SELECT statement works fine in DB2, but not in Data Migrator Is there a different syntax for using RIGHT function in Data Migrator?
February 11, 2013, 02:35 PM
ClifWhile most common SQL functions are supported in what we used to call "EDA/SQL" some DB2 functions like RIGHT are not included. There's a list in the
DataMigrator User's Guide.
However in the current production release 7.7.05 you can indicate a database specific function using the new function DB_EXPR.
DB_EXPR(RIGHT(RTRIM(T1.SENDER_ID), 3) )
In prior releases you could use a DBMS SQL Flow to write dialectic specific SQL.
February 12, 2013, 01:25 PM
AnnaRThank you Clif.
In your statement "In prior releases you could use a DBMS SQL Flow to write dialectic specific SQL" do you refer to using data transformation on either source or target to get the final result as RIGHT function would have done?
February 12, 2013, 03:50 PM
ClifNo, I meant that you could use a DBMS SQL Flow.
Right click on an application directory and select New > DBMS SQL Flow. This special flow type has only a SQL object and target(s). Right click on the SQL object and select Properties to specify your adapter and connection. Then double click to open the SQL object where you can paste or write your DB2 SELECT statement.
Another alternative as you state is to write FOCUS transformations to achieve the same result. In fact in a source transformation could use this syntax to invoke the DB2 RIGHT function
SQL.RIGHT(RTRIM(T1.SENDER_ID),3)
However this at the cost of disabling automatic pass through (APT) which can adversely affect throughput.