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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Help with Date Calc

Author  Topic 

Harry C
Posting Yak Master

148 Posts

Posted - 2005-06-24 : 15:58:19
The Select Statement above would return a record like so
ProjectID :: EventID :: EstimatedCompletionDate :: LeadTime
1 :: 1 :: :: 10
1 :: 2 :: :: 20
1 :: 3 :: :: 5

So, what I need to do here is to take @CustomerShipDate, which is passed into the stored proc, the count the days backward. So, if @CustomerShipDate were 07/25/2005, and I were calculating for EventID 3. I could say DateAdd(day, LeadTime(which is 5), @CustomerShipDate).

But, now, how would I get the rest of the values?? Because now, for EventID 2, I need to say
DateAdd(day, LeadTime(EventID 3 LeadTime which is 5 MINUS EventID 2 LeadTime which is 20 ), @CustomerShipDate)

Does this makes sense? Thanks for looking

INSERT INTO ProjectEvent(ProjectID, EventID, EstimatedCompletionDate, LeadTime)
SELECT @ProjectID, CompanySeasonProductTemplate.EventID, (Calculate Estimated CompletionDate Here), Event.LeadTime
FROM CompanySeasonProductTemplate INNER JOIN
Event ON CompanySeasonProductTemplate.EventID = Event.EventID
WHERE (CompanySeasonProductTemplate.CompanyID = @CompanyID)
AND SeasonID Is Null
AND ProductCategoryID Is Null
ORDER BY EventOrder

Harry C
Posting Yak Master

148 Posts

Posted - 2005-06-24 : 15:59:30
Sorry, I meant to post this in the TSQL forum...so sorry...
Go to Top of Page
   

- Advertisement -