Focal Point
SQL RIGHT FUNCTION USED IN SELECT STATEMENT

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/1381057331/m/3117075826

February 06, 2013, 03:32 PM
AnnaR
SQL 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?


WebFOCUS 7.7, iWay Data Migrator, Windows
Excel, PDF, HTML, XML
February 11, 2013, 02:35 PM
Clif
While 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.


N/A
February 12, 2013, 01:25 PM
AnnaR
Thank 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?


WebFOCUS 7.7, iWay Data Migrator, Windows
Excel, PDF, HTML, XML
February 12, 2013, 03:50 PM
Clif
No, 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.


N/A