Få output parameter fra Stored Procedure vist på asp side
Hejjeg har en udfordring med at få output parameter tilbage fra en Stored Procedure (sql server). Jeg kan godt få fat i værdien på asp siden, hvis jeg tager den som return value, men det kan jeg ikke bruge fordi det er en int.
Den værdi jeg vil have tilbage er en type real.
Stored Procedure:
ALTER PROCEDURE [dbo].[updateFlexTimeReg]
@update int,
@RecordedHoursTimeReg real output, @normalHoursTimeReg real output, @MissingDaysInHoursTimeReg real output, @flexHoursTimeReg real output, @flexAccountChange real output, @userIdOut int output, @oldflexAccount real output, @newflexAccount real output
AS
DECLARE
@userDate date, @userInit as string_short, @dayWorkHours real, @counter int, @userId INT
DECLARE flex_Cursor CURSOR FAST_FORWARD FOR
select distinct Id from userGroup where TimeCalculation = 0
and id = 117618
order by id asc
OPEN flex_Cursor;
FETCH NEXT FROM flex_Cursor INTO @userId;
WHILE @@FETCH_STATUS = 0
BEGIN
exec NormalHoursTimeReg @userId, @normalHoursTimeReg output
exec MissingDaysInHoursTimeReg @userId, @MissingDaysInHoursTimeReg output
exec flexHoursTimeReg @userId, @flexHoursTimeReg output
exec RecordedHoursTimeReg @userId, @RecordedHoursTimeReg output
select @flexAccountChange = (@RecordedHoursTimeReg - @normalHoursTimeReg) + @flexHoursTimeReg + @MissingDaysInHoursTimeReg
select @userIdOut = @userId
print('normalHoursTimeReg')
print(@normalHoursTimeReg)
print('RecordedHoursTimeReg')
print(@RecordedHoursTimeReg)
print('MissingDaysInHoursTimeReg')
print(@MissingDaysInHoursTimeReg)
print('flexHoursTimeReg')
print(@flexHoursTimeReg)
print('flexAccountChange')
print(@flexAccountChange)
print('userId')
print(@userIdOut)
select @oldflexAccount = flexTimeHours from userGroup where id = @userId
select @newFlexAccount = @oldflexAccount + @flexAccountChange
IF @update = 0
begin
update UserGroup set oldflexTimeHours = @oldflexAccount where id = @userId
update UserGroup set flexTimeHours = @newflexAccount where id = @userId
update UserGroup set flexUpdated = GETDATE() where id = @userId
end
print('@oldflexAccount')
print(@oldflexAccount)
print('newFlexAccount')
print(@newFlexAccount)
FETCH NEXT FROM flex_Cursor INTO @userId;
END;
CLOSE flex_Cursor;
DEALLOCATE flex_Cursor;
--return @newFlexAccount