DECLARE test_cursor CURSOR FOR SELECT ID FROM dbo.T_BD_Restaurant WHERE id <> ‘0AAB2E55-79F8-4F41-AFFA-00179DFABDB0‘ OPEN test_cursor DECLARE @RestaurantID NVARCHAR(100) FETCH NEXT FROM test_cursor INTO @RestaurantID WHILE @@FETCH_STATUS = 0 BEGIN PRINT @RestaurantID FETCH NEXT FROM test_cursor INTO @RestaurantID END CLOSE test_cursor DEALLOCATE test_cursor