Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Script error (Invalid timestamp in Teradata

Hi All,

I'm hitting an error in Teradata as invalid timestamp  (SqlState: S1000, ErrorCode: 4294960536, ErrorMsg: [Teradata][ODBC Teradata Driver][Teradata Database] Invalid timestamp.)

Below is the script.

Max:
load *;
SQL select
Max(MODIFIED_DATE) AS A
from TABLE1 WHERE  ACTIVE_FLAG='N';

let maxDate= Timestamp(Peek('Max',0,'A'));

Drop Table Max;

TBL:

Load*,

Sql select

Field1,

Field2,

Field3

from TABLE1 WHERE  ACTIVE_FLAG='Y' OR  (ACTIVE_FLAG='N' AND MODIFIED_DATE>= cast ('$(maxDate)' as TIMESTAMP(0) FORMAT 'MM/DD/YYYYBHH:MI:SS')) AND MANUAL_FLAG='Y';

Please suggest what's going wrong here.

Thanks in advance

5 Replies
crusader_
Partner - Specialist
Partner - Specialist

Hi,

Are you sure that

cast ('$(maxDate)' as TIMESTAMP(0) FORMAT 'MM/DD/YYYYBHH:MI:SS'))

is valid SQL expression?


Edit:

     As I rememeber you are not allowed use Qliikview variables in SQL statement.


Kind regards,

Andrei

Not applicable
Author

There's no difference without it too as i felt TIMESTAMP() would be fine and tried but there's no difference.

crusader_
Partner - Specialist
Partner - Specialist

Does you query work without MODIFIED_DATE>= cast ('$(maxDate)' as TIMESTAMP(0) FORMAT 'MM/DD/YYYYBHH:MI:SS')) expression?

Not applicable
Author

Yes.It's working fine without that statement.

crusader_
Partner - Specialist
Partner - Specialist

The problem in using Qlikview variable in SQL statement.

Just load data without this condition, than Reload table using this condition.

Hope this helps.

Andrei