i try to get an interval between current day and day three month ago
this is the code:
LastBetDate BETWEEN swf_dateadd ('day', -90,CURRENT_TIMESTAMP) AND CURRENT_TIMESTAMP);
but i get this error:
yntax error: expected something between the 'BETWEEN' keyword and the 'day' keyword.
What is swf_dateadd, a SQL UDF? Can you show the source code?
LastBetDate BETWEEN CURRENT_TIMESTAMP - INTERVAL '90' DAY AND CURRENT_TIMESTAMP -- 90 days or LastBetDate BETWEEN ADD_MONTHS(CURRENT_TIMESTAMP, -3) AND CURRENT_TIMESTAMP -- 3 months
#1 shows SQL Server syntax (due to GETDATE/CLUSTERED INDEX) and #2 should be Teradata (due to ON COMMIT).
I need the source code of swf_dateadd, there's no builtin function with that name in TD.
First check where the function is installed:
SELECT * FROM dbc.FunctionsV WHERE FunctionName = 'swf_dateadd'
Then do a SHOW FUNCTION.
Btw, are you sure about the error message?
The function might not be found by the parser, then it fails with
"Syntax error: expected something between '(' and the string 'day'", but not "and the 'day' keyword".