i use below SQL Script in SQL Server and they are work fine:
(select CONVERT(varchar(10),GETDATE(),120)+' 08:00:00')
(select CONVERT(varchar(10),GETDATE()+1,120)+' 08:00:00')
but when i use below SQL Script in metabase they report error:
(select CONVERT(varchar(10),{{start_date}},120)+' 08:00:00')
(select CONVERT(varchar(10),{{end_date}}+1,120)+' 08:00:00')
Hi @ljqPro
The variable is a string if it is a Date variable, so you'll likely need to cast it, but without you posting the error, then it's impossible to know.
When trying to debug variables, then replace the variable with a hardcoded value, so you know if the problem is your query.
that means " Operand type clash: int is incompatible with date"
my sql is below:
[[WHERE i.cldate BETWEEN (select CONVERT(varchar(10),{{start_date}},120)+' 08:00:00') AND (select CONVERT(varchar(10),{{end_date}}+1,120)+' 08:00:00')]]
@flamber thanks a lot and i update the sql script as below and it's work fine:
[[WHERE i.cldate BETWEEN (select CONVERT(varchar(10),{{start_date}},120)+' 08:00:00') AND (select CONVERT(varchar(10),DATEADD(day,1,{{end_date}}),120)+' 08:00:00')]]