Declare
@counter int = 0,
@strt date,
@end date
Begin
set @strt=(Select Distinct StartDate
From SchoolTerms
where EmisCode ='500226884'
AND CurrentYear='2009'
AND Quater='Term1')
Set @end=(Select Distinct EndDate
From SchoolTerms
where EmisCode ='500226884'
AND CurrentYear='2009'
AND Quater='Term1')
while (@strt<@end)
if DATEPART(weekday,@strt)<>7 or DATEPART(weekday,@strt)<> 1
set @counter+=1
set @strt=@strt-1
print @strt
print @end
print @counter
End;
我在长期的总天数计算下面的代码,但我得到以下错误。
{C}| SandraCy