Updating table with looped stored proc using cursor
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
I then delete all records for that userid.
The problem is that I need to loop thru the table. How do I do this with
I have the following stored proc:
CREATE PROCEDURE AdminBasketClearDetails
set nocount on
declare @userid varchar(50)
declare @labID Int
set @userid = (select locationemail from userlog where sessionid = substring(@SessionID,1,40))
set JobStatus = 6
Delete From BasketUploads
Where UserId = @UserID
I'd appreciate it greatly if you could help with this one.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL