Date+"08:00:00' can't run

hello everyone,

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')

so how?

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.

image

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')]]

@ljqPro Yes, like I say {{end_date}} is translated to '2022-06-22' - which is a string, so you cannot do +1 on a string.

@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')]]