SQL Scripting Error in Rule Definition

I am attempting to write a rule that checks a date, stored as a epoch unix timestamp integer, and have it fail the rule if that date is greater than current date. the code is as followed:

DECLARE
$EST_DATE datetime;
BEGIN
$EST_DATE = SQL(‘dataconnection’, 'SELECT DATEADD(s,epcoch_date_field, ‘1970-01-01 00:00:00’) From table) ;
If ($EST_DATE < sysdate())
RETURN TRUE;
ELSE
RETURN FALSE;
END
I get the error for the SQL script line of
Syntax Error at . (COR 10611)

Any ideas on how to accoplish this or resolve error?


daguas (BOB member since 2011-06-29)

Update on Issue: I have corrected the original sytax error: I neglected to preceed the embedded qoutes with the , I have done that now I get a new error that currently does not make sense to me.

I now get the error on the SQL line 4: Datatype incompatibilty: found type But expecting . (COR-10600)

The DATEADD SQL Function returns a datetime, not a varchar, so I am unclear as to why I would get this error.

Any thoughts, insights or assistance would be greatly appreciated!


daguas (BOB member since 2011-06-29)

What does happen when you execute the code in the SQL Server Management Console? Does it work then and what is the SQL text then exactly?


Werner Daehn :de: (BOB member since 2004-12-17)

what version of IS is this IS 4.1 SP1 ?


manoj_d (BOB member since 2009-01-02)