Skip to content
Advertisement

How to see if date is in current month SQL Server?

I have a Ticket_Date column that is in the format YYYY-MM-DD HH:MI:SS

I want to check if the Ticket_date is in the current month.

So far I have :

but I need it to work with the current month rather then hardcoded

Advertisement

Answer

but i would also save current date in variable to guarantee what result of getdate() doesn’t change when executing long query at midnight

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement