I have a table called Genericattribute. It's as shown here.
I need to make a Trigger or a query that checks if today is the birthday of any of these employees.
I wrote a query that returns the Ids of the people along with their birthdays.
select [id],[value] from [Genericattribute]
where [key] = 'DateOfBirth'
It returned this output.
The date of births here are of the int type. Not the Date type.
I am unable to figure out how I can write a query that converts these int values to the date.
I have tried to use the getdate()
to check today's date/time.
Could not find any solution to figure this problem.
CodePudding user response:
Just a thought. Since [value]
appears to be a string.
where [key] = 'DateOfBirth'
and right(value,5)=format(getdate(),'MM-dd')
I normally shy away from format()
due to the performance issues, but in this example it would be resolved once.