-- Declare the cursor
DECLARE myCursor CURSOR FOR
SELECT id, name FROM myTable
-- Open the cursor
OPEN myCursor
-- Fetch the first row
FETCH NEXT FROM myCursor
-- Declare variables to store values
DECLARE @id INT, @name VARCHAR(50)
-- Loop through the cursor
WHILE @@FETCH_STATUS = 0
BEGIN
-- Get the values from the cursor
FETCH NEXT FROM myCursor INTO @id, @name
-- Update or delete the current row based on the condition
UPDATE myTable SET name = 'New Name' WHERE CURRENT OF myCursor
-- or
DELETE FROM myTable WHERE CURRENT OF myCursor
END
-- Close and deallocate the cursor
CLOSE myCursor
DEALLOCATE myCursor