Quote:
Run it in HANA and you are see the errors please
Nope - can't afford it. In the meantime why don't you just
tell us which of the declare statements causes an issue? Help us to help you.
I'm going to hazard a guess that it's this line that it's moaning about
declare @fdate DATE = '220106'
What date is that meant to be? 1st June 2022 or 6th January 2022 or perhaps 1st June 1922. Use
ISO 8601 date format[
^] to remove the confusion and it might just solve your problem e.g. for 6th June 2022 use
declare @fdate DATE = '20220106'
A better place to get support on this would be the Help Portal from SAP - see
SAP Help Portal[
^]
Edit: I feel I should also pick up on the comment from Gerry Schmitz (@salty06) - this code
select sum("DocTotal") from OINV where OINV."CardCode" like '%'+ 'C20000' +'%' and cast(@fdate as date) between cast(@fdate as date)
and cast(@tdate as date)
contains some pointless casts.
@fdate
and
@tdate
are already dates. There is no need for the cast. So, use
select sum("DocTotal") from OINV where OINV."CardCode" like '%'+ 'C20000' +'%' and @fdate between @fdate and @tdate
Which then just highlights another issue -
@fdate
will ALWAYS be between itself and another date. You probably meant to use a column name there
select sum("DocTotal") from OINV where OINV."CardCode" like '%'+ 'C20000' +'%' and [aColumnName] between @fdate and @tdate