I created a table called test with two columns tid(identity int) and 
tdate(datetime
filled it with date values. This is in SQL2k

SELECT     *
FROM         test
where datepart(month,tdate) Between 1 and 2
and datepart(year,tdate) =2005

-----Original Message-----
From: Mickael [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 17, 2005 10:19 AM
To: CF-Talk
Subject: OT - Sql Help


Hi All,

I am a little stumped with the following task in SQL which seems simple enough 
to me.  I have a form that my users can select a range of Dates for a 
particular report.  The range is not day month year, but month and year and 
ending month and year.

In my database I have a date field, it is only one date.  The date is 
(dd/mm/yyyy) format.  Let's say that I have
5 records for Jan 5, 5 records for Feb 1 and 5 records for feb 15.

I would like to capture those 15 records by saying

select * from table where date between Jan2005 and feb2005 ( so in essence
not having to say Jan 1, 2005 and Feb 28, 2005)

Can this be done?

Thanks

Mike







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:195192
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to