You have created a cursor named test_cursor inside your stored procedure. Following is the cursor code: --------------------------------------------------------------------- DECLARE @Name AS VARCHAR(100) DECLARE test_cursor CURSOR FOR SELECT empname FROM Employee Order BY empid OPEN test_cursor FETCH NEXT FROM test_cursor INTO @Name WHILE @@FETCH_STATUS <> 0 BEGIN -- Do your internal procesing here FETCH NEXT FROM test_cursor INTO @Name END CLOSE test_cursor DEALLOCATE test_cursor --------------------------------------------------------------------- What correction is required in the code above?