I know that this is very popular question and I found an answer to it, but not optimal.
So the task is - I need to know which of the employees are on vacation at the moment if start day of the vacation is bigger or equal than today and end date of the vacation is bigger or equal than today.
The problem is that dates of start and end of vacation are datetime so I can't compare it with getDate(). Varchar conversion of dates doesn't works also.
I solved the task by this way:
WHERE
(
YEAR (vac.e_dateTo) = YEAR (getDate()) AND
MONTH (vac.e_dateTo) = MONTH (getDate()) AND
DAY (vac.e_dateTo) >= DAY (getDate()) AND
DAY (vac.e_dateFrom) <= DAY (getDate())
)
but it seems to me that it can be done with cast/convert but I don't underestand how. Will be greatfull for any advise.