I have a question regarding how to use the formula property to be used in the SQL where clause. Sepcifically, I’d like to use (datepart(hh, getdate())) as the formula and the resulting SQL that I expect is
Select select_list from table_name
where (datepart(hh, getdate())) < 17
But I kept the where clause like this:
where (this_0_.hh, getdate())) <= 17
I am not sure why the alias is inserted before the “hh” date part.
Any help on how to get this where clause right is highly appreciated!
Thanks.
The alias is inserted because the parser doesn’t know
hhis a literal (if MS had used a string, you wouldn’t have this problem, as you’d be able to use'hh'without a problem)The easiest workaround is creating a function (call it
gethour) that returnsdatepart(hh, getdate()).