i need to assign a value to variable from the sql statement within a cursor. how can this be done. needs to be because all the logic is within the SP (done for testing purposes, will have a business layer for the application). the following is my code:
declare curEmp cursor for
select * from tblFirm f, tblEmployee e, tblEmpClassCode ecc
where
f.firmID=e.firmID and
f.firmID='1' and
e.employeeID='1' and
ecc.firmID=f.firmID and
ecc.employeeID=e.employeeID
open curEmp
fetch next from curEmp
while (@@fetch_status=0)
begin
-- HERE IS WHERE ADDITIONAL STATMENTS WOULD BE USING
-- THE VARIABLES CREATED FROM THE 1ST STATEMENT...
-- HOW CAN I ASSIGN VALUES?
fetch next from curEmp
end
close curEmp
deallocate curEmp
thanks for any help
declare curEmp cursor for
select * from tblFirm f, tblEmployee e, tblEmpClassCode ecc
where
f.firmID=e.firmID and
f.firmID='1' and
e.employeeID='1' and
ecc.firmID=f.firmID and
ecc.employeeID=e.employeeID
open curEmp
fetch next from curEmp
while (@@fetch_status=0)
begin
-- HERE IS WHERE ADDITIONAL STATMENTS WOULD BE USING
-- THE VARIABLES CREATED FROM THE 1ST STATEMENT...
-- HOW CAN I ASSIGN VALUES?
fetch next from curEmp
end
close curEmp
deallocate curEmp
thanks for any help