Well you probably don't want to be using a cursor in the first place... However, you can do 1 of two thingsYou could do this:DECLARE db_cursor CURSOR FOR SELECT [fName] , [Lname]FROM employeeWHERE [empId] > 100 AND ( [age] < CASE @mode WHEN 'A' THEN [age] + 1 ELSE 50 END OR [age] IS NULL )OPEN db_cursor FETCH NEXT FROM db_cursor INTO @FName, @LName.
OR you could have a simple IF condition and then declare the cursor differently depending on whether the @mode is A or B.LikeIF @mode = 'A' BEGIN DECLARE db_cursor CURSOR FOR...... .....ENDELSE BEGIN DECLARE db_Cursor CURSOR FOR....... .....END......
Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION