1

I have a Teradata-SQL-Query that auto-created through FinBI SAP tool. I am trying to use that query in Tableau as a New Custom SQL. Due to differences in the synax I am getting an error.

Below is the query that I pulled from FinBI SAP Tool.

SELECT
  ABC.PRODUCT_ID,

sum(CASE WHEN DEF.SERVICE_FLG = 'N' THEN DEF.COMP_US_NET_PRICE_AMT ELSE 0 END),
  Sum(CASE WHEN DEF.SERVICE_FLG = 'N' THEN DEF.COMP_US_LIST_PRICE_AMT ELSE 0 END),
  Sum(CASE WHEN DEF.SERVICE_FLG = 'N' THEN DEF.COMP_US_COST_AMT ELSE 0 END),
  Sum(CASE WHEN DEF.SERVICE_FLG = 'N' THEN DEF.EXTENDED_QTY ELSE 0 END)
,
  GHI.FISCAL_YEAR_NUMBER_INT,
   GHI.JKL,
  MNO.GU_PRIMARY_NAME
FROM
  ABC,
  DEF,
  GHI,
  MNO
WHERE
  ( DEF.FISCAL_YEAR_QUARTER_NUMBER_INT=GHI.FISCAL_YEAR_QUARTER_NUMBER_INT  )
  AND  ( ABC.ITEM_KEY=DEF.PRODUCT_KEY  )
  AND  ( DEF.END_CUSTOMER_KEY=MNO.END_CUSTOMER_KEY  )
  AND  ( DEF.PRODUCT_KEY  IN  ( SELECT ITEM_KEY FROM ABC H    JOIN PQR S    ON H.TECHNOLOGY_GROUP_ID = S.TECHNOLOGY_GROUP_ID      WHERE user_id=@Variable('BOUSER') AND IAM_LEVEL_NUM=1   )  )
  AND  ( DEF.DV_ATTRIBUTION_CD IN ('ATTRIBUTED','STANDALONE')  )
  AND  
  (
   ABC.BUSINESS_UNIT_ID  IN  ( 'xyz'  )
   AND
   DEF.REVENUE_RECOGNITION_FLG  IN  ( 'Y'  )
  )
GROUP BY
  1, 
  6, 
  7, 
  8

enter code here
  • 1
    Instead of image of the code, you should paste the code. – Ganesh Satpute Mar 05 '20 at 06:48
  • I tried to paste the code but since it is long it was not allowing me to. Hence had to paste it as a image. – meghana jain Mar 05 '20 at 06:53
  • Try to paste minimal reproducible example as shown here https://stackoverflow.com/help/minimal-reproducible-example – Ganesh Satpute Mar 05 '20 at 06:54
  • I tried a way & it worked. Pasted it for you. – meghana jain Mar 05 '20 at 07:00
  • So what is the error? The term @Variable('BOUSER') - i.e. the name of the current user on the client side - is something specific to SAP BI and what is passed to the database is just a character literal in place of this expression. I don't know if Tableau has any similar functionality. – Fred Mar 05 '20 at 18:29
  • The below is the error message that I got but table ABC exists in the database. An error occurred while communicating with Teradata. Invalid table name value [Teradata][ODBC Teradata Driver][Teradata Database](-3807)Object 'ABC' does not exist. [Teradata][ODBC Teradata Driver][Teradata Database](-3807)Object 'ABC' does not exist. – meghana jain Mar 06 '20 at 17:04
  • If ABC is the unqualified name of an object that exists in some database XYZ, you may need to set the default database for the session `DATABASE XYZ;` or qualify the table name with the database name `FROM XYZ.ABC`. It's also possible to set a default at the user level `MODIFY USER myuser AS DEFAULT DATABASE = XYZ;` – Fred Mar 09 '20 at 21:38

0 Answers0