Hi Experts -
I'm trying to CASE a value for hours that fall between a date given as a parameter and the effective first day of the timesheet period - but I seem to be having an issue with the format of either the date in the comparison statement or the converted date to determine the first day of the week.
The error is Error Converting data type Varchar to Numeric
@Project VARCHAR(30), @Phase VARCHAR(7), @Task VARCHAR(7),
Set @Project = '01080901'
Set @Phase = '0301'
Set @Task = '00'
Set @custThroughDate = '5/29/2009'
Project as Project,
Phase as Phase,
Task as Task,
CASE WHEN RecType IN ('Labor','Unposted') AND
Transdate >= DATEADD(dd, - DATEPART(dw, CONVERT(varchar, @custThroughDate, 101)), CONVERT(varchar, @custThroughDate, 101))
AND Transdate <= @custThroughDate
THEN RegHrs + OvtHrs + SpecialOvtHrs ELSE '' END AS CurrentWeekHrs
vwAA_BRRecTypeBillStatus where Project = @Project AND Phase = @Phase AND Task = @Task