Skip to Content
avatar image
Former Member

Data Services SQL Transform Syntax error

I am more familiar with SQL & new to Data services. I need to write the following in Data Services but get syntax error. Hoping you can help. I have checked other questions and attempted to correct syntax, but need assistance please.

<sql('AnalyticsDB', "SELECT HOUSEHOLD.BUYERNBR,
HOUSEHOLD.EVENTYYMMDD, HOUSEHOLD.HH,
HOUSEHOLD.TRANSDATE, HOUSEHOLD.HHID
FROM HOUSEHOLD WHERE HOUSEHOLD.BUYERNBR IN
(SELECT HOUSEHOLD.BUYERNBR FROM HOUSEHOLD
WHERE '20' + HOUSEHOLD.EVENTYYMMDD > [@g_Max_Date])")

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Nov 23, 2017 at 07:24 AM

    Hi Patty,

    One example below, if it is a string in a sql, you should use \'value\' here.

    sql('test', 'select * from KNA1 where LAND1=\'US\'')

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Patty,

      What's the exact error your see?

      I tried to use the following in my env and it worked.
      sql('test', 'SELECT * FROM HOUSEHOLD WHERE EventYYMMDD = \'171120\'');

      Hope it is not ";" at the end that cause your expression error.

      Best regards

      Helen