I'm still learning SQL syntax, so please forgive me. I have a stored procedure I have written that has nested IF / ELSE statements and multiple INSERT / UPDATE statements. I checked the syntax in enterprise manager and it checked out OK. I then went to the debug function in Query analyzer and passed variables to see if it worked. It ran fine but the records were not updated or inserted. (I'm going to really feel stupid if that's the way the debugger is supposed to work!) Before I go banging my head against a wall I figured I'd see if someone can take a quick look at the procedure for me to see if there's something glaringly wrong.The procedure basically checks to see if the "reviewer" has already reviewed this record, then checks to see if the review count requirement has been met and executes the same SQL statements but returns a different value based on the 3 possibilities. My application will then handle the next steps. Thanks in advance, code follows.CREATE PROCEDURE usp_IntRevApprove @SONum nvarchar(10),@RevID int,@reviewer char(10) ASDeclare @revtime datetimeSET @revtime = GETDATE()Declare @revcount intSET @revcount = (SELECT Count(SONUM) FROM OrderReviews WHERE SONum = @SONum AND RevID=@RevID)SET @revcount = @revcount + 1Declare @revreq intSET @revreq = (SELECT reviewreq FROM Revisions WHERE SONum = @SONum AND RevID=@RevID)Declare @reviewed intSET @reviewed = (SELECT Count(SONum) FROM OrderReviews WHERE SONum = @SONum AND RevID=@RevID AND reviewer=@reviewer)IF @reviewed = 0BEGIN IF @revcount >= @revreq BEGIN UPDATE Revisions SET reviewcount = @revcount WHERE SONum = @SONum AND RevID = @RevID INSERT INTO OrderReviews (SONum, RevID, reviewer, accepted, revtime) VALUES (@SONum, @RevID, @reviewer, 'yes', @revtime) RETURN -1 END ELSE BEGIN UPDATE Revisions SET reviewcount = @revcount WHERE SONum = @SONum AND RevID = @RevID INSERT INTO OrderReviews (SONum, RevID, reviewer, accepted, revtime) VALUES (@SONum, @RevID, @reviewer, 'yes', @revtime) RETURN -2 END ENDELSE BEGIN RETURN -3 ENDGO