Steve writes "Hello folks,Here's the problem:I have a temporary table (basketuploads) with jobid, filename, userid. I have a main table (jobs) with jobid, userid, reportname, jobstatus.I need to update the main table by setting jobs.reportname = basketuploads.filename, jobs.jobstatus = '6' where jobs.jobid = basketuploads.jobid and jobs.userid = basketuploads.useridI then delete all records for that userid.The problem is that I need to loop thru the table. How do I do this with a cursor?I have the following stored proc:==================CREATE PROCEDURE AdminBasketClearDetails@SessionID VarChar(50)ASset nocount ondeclare @userid varchar(50)declare @labID Intset @userid = (select locationemail from userlog where sessionid = substring(@SessionID,1,40))update Jobsset JobStatus = 6 where JobIDin ( select JobID from BasketUploads )Delete From BasketUploadsWhere UserId = @UserIDGO======================
I'd appreciate it greatly if you could help with this one.Cheers,Steve"