I have a varchar column in a table that holds the month and date of a report. In order to retrieve the reports that were created this month I need to do the following select statement:
Select *
From tDbhreports
Where RepPeriod = '10/2006'
However I don't want to hardcode the date. I need it to use the current month and year.
I searched the web and tried many options I found and none worked. Here is one of them:
Select *
From tDbhreports
WHERE RepPeriod = right(Convert(varchar(20),getdate(),3),5)
Can someone help me?
Select *
From tDbhreports
Where RepPeriod = '10/2006'
However I don't want to hardcode the date. I need it to use the current month and year.
I searched the web and tried many options I found and none worked. Here is one of them:
Select *
From tDbhreports
WHERE RepPeriod = right(Convert(varchar(20),getdate(),3),5)
Can someone help me?