Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT all records from current month query

Status
Not open for further replies.

jasonsalas

IS-IT--Management
Jun 20, 2001
480
GU
I've been trying to grab all records from the current month, but I've run into trouble. This is what I'm using:

SELECT ColumnID,ColumnDate FROM TableName WHERE ColumnDate = MONTH(GETDATE())

Got any pointers on how to evaluate a column of type SMALLDATETIME, only looking within the current month?

Thanks!
 
<GROAN!>

In lieu of more accurate testing, I think this works (figured it out in .002 seconds after my post):

SELECT ColumnID,ColumnDate FROM TableName WHERE MONTH(ColumnDate) = MONTH(GETDATE())
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top