views:

15

answers:

1

I have a set of projectnames stored in the database

projectname - project1 with startdate and enddate

How to find which task is at present going on, based on today's date ( note : two projects may have same dates too). I need to take the project names which falls under today date from all the other projects.

select distinct ProjectName 
from ProjectPlan  
where UserName=@username  
and  month(StartTime)='2' 

This shows me the tasks under 2nd month and not exact project which is at present date.

Any idea ???

A: 
select distinct ProjectName from ProjectPlan where
UserName=@username and
GETDATE() BETWEEN StartDate AND EndDate

This ignores the effect of time on EndDate though

gbn
thanks for the reply yaar...but this will check only the today date is in between two dates.but if the date is at Startdate or at EndDate it shows me empty value without fetching the taskname.Any idea??
Ranjana
On the StartDate will be OK. For EndDate, you need to add one day
gbn