[thelist] Using Wildcards and Dates in SQL Server

Gary McPherson genyus at ingenyus.net
Tue Jun 17 12:09:22 CDT 2003


> -----Original Message-----
> From: thelist-bounces at lists.evolt.org 
> [mailto:thelist-bounces at lists.evolt.org] On Behalf Of David Mitchell
> Sent: 17 June 2003 17:58
> To: thelist at lists.evolt.org
> Subject: RE: [thelist] Using Wildcards and Dates in SQL Server
> 
> 
> So you're trying to get all records for June 2003? Try this:
> 
> SELECT * from curEvents where DATEPART(month, GETDATE()) = 6 
> and DATEPART(year, GETDATE()) = 2003

Ummm... I imagine he'd want to use the date for that record, not the
current date:

SELECT * FROM curEvents WHERE DATEPART(month, eDate) = 6 AND
DATEPART(year, eDate) = 2003

HTH,

Gary




More information about the thelist mailing list