print @totalAmount just does nothing but there are data in all tables and the loop does execute for all rows in tableSPID
and i get the first row before the start of while loop.
the result only shows x amount of rows effected but nothing
with @totalAmount
Code:
FETCH NEXT FROM curSPID into @iint --gets first value(s0 from cursor
while @counter < @totalRows --check start VS total
begin
set @counter = @counter + 1
set @totalAmount = @totalAmount + (
SELECT SUM(AmountFromBudget)
FROM Claims_Consultants
WHERE ProjectSPID= @iint
)
set @totalAmount = @totalAmount + (
SELECT SUM(AmountFromBudget)
FROM Claims_Contractors
WHERE ProjectSPID= @iint
)
print @totalAmount
FETCH NEX
-- This message may have been cut off and the rest will only be shown to members. To become a member, click here --