Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jia9211
Starting Member
7 Posts |
Posted - 2004-06-19 : 03:21:55
|
| I have a table ResourceAssignments in SqlServer 2000 with following data.ResName..........FromDate.........ToDateJohn 6/4/2004 6/12/2004John 6/17/2004 6/22/2004Peter 6/20/2004 6/27/2004I want a stored procedure which gives me all the resources who are free from 6/12/2004 to 6/18/2004.Thanks |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2004-06-19 : 04:29:23
|
| create procedure prc_FreeResources@StartDate DateTime,@ToDate DateTimeasselect ResName, FromDate, ToDate from ResourceAssignmentswhere FromDate <= @StartDate and ToDate >= @ToDate |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-06-19 : 05:01:49
|
| Please don't double post. It's not considered proper etiquette. :)MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
jia9211
Starting Member
7 Posts |
Posted - 2004-06-19 : 05:01:52
|
| brother this doesnt work,as for example if i want to check that who is available from 6/13/2004 to 6/16/2004, your query will return only Peter, but as you can see it should also return John as he is not assigned to any task in these days. |
 |
|
|
jia9211
Starting Member
7 Posts |
Posted - 2004-06-19 : 11:12:03
|
| Thx for providing this help query, my problem is solved now, actually am new to TSQL and wasnt aware of Left Join like things.Thanks again |
 |
|
|
|
|
|