I want to replace the like
statement with this function
select year(GetDate()) and add '%'
Can you help me how to do it?
Here is the SQL statement:
Select *
from table a
where = month like '2023%'
I expect same result like the SQL statement, but replace with year(getdate())
statement.
1条答案
按热度按时间ep6jt1vc1#
First of all, I'm not sure whether string comparison makes sense in this case.
Nevertheless, I think you're looking for something like this (Convert to nvarchar and append %):
Full query: