i am now having difficulty with error 512,
"Server: Msg 512, Level 16, State 1, Procedure WeeklyBonus, Line 40
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression."
the issue is that there are multiple records for each employee, and i want them condensed into one, but do not know the syntax to do this. for example, in line 40,
"Set @totalhours = (Select ldRegHrs From LD) + (Select ldOvtHrs From LD)"
in this line, there may be 25 lines for one employee, and i want them added up. this error is dislayed for these lines;
Set @totalhours = (Select ldRegHrs From LD) + (Select ldOvtHrs From LD)
If (Select emSelect1 From EM) = "salary"
Set @paidhours = @weeksworked * 40
Else
Set @paidhours = @totalhours
If (Select emStatus From EM) = "A" and (Select emSelect18 From EM) = 0
Set @weeksworked = @weeknumber
Else
If @weeknumber < (Select emSelect18 From EM)
Set @weeksworked = 0
Else
If @weeknumber = (Select emSelect18 From EM)
Set @weeksworked = 1
these are copied out of a stored procedure, so they may not have the correct beginning and ending syntax.
thanks for any help. i am stumped.
"Server: Msg 512, Level 16, State 1, Procedure WeeklyBonus, Line 40
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression."
the issue is that there are multiple records for each employee, and i want them condensed into one, but do not know the syntax to do this. for example, in line 40,
"Set @totalhours = (Select ldRegHrs From LD) + (Select ldOvtHrs From LD)"
in this line, there may be 25 lines for one employee, and i want them added up. this error is dislayed for these lines;
Set @totalhours = (Select ldRegHrs From LD) + (Select ldOvtHrs From LD)
If (Select emSelect1 From EM) = "salary"
Set @paidhours = @weeksworked * 40
Else
Set @paidhours = @totalhours
If (Select emStatus From EM) = "A" and (Select emSelect18 From EM) = 0
Set @weeksworked = @weeknumber
Else
If @weeknumber < (Select emSelect18 From EM)
Set @weeksworked = 0
Else
If @weeknumber = (Select emSelect18 From EM)
Set @weeksworked = 1
these are copied out of a stored procedure, so they may not have the correct beginning and ending syntax.
thanks for any help. i am stumped.