Olá substitui a parte que comentaste por este código...não criei a tabela para validar, mas será algo por aí. Valida e dá feedback. ``` DECLARE MSN_CURSOR CURSOR FOR SELECT * FROM #temp_msn_one; OPEN MSN_CURSOR FETCH NEXT FROM MSN_CURSOR INTO @nickname, @u_id, @apelido_in, @unknown_1, @unknown_2, @unknown_3, @unknown_4, @unknown_5, @unknown_6, @flag_1, @flag_state, @player_flag WHILE @@FETCH_STATUS = 0 BEGIN IF EXISTS (SELECT uid FROM #temp_msn_one WHERE UID = @u_id) UPDATE #temp_msn_one SET FLAG_PLAYER = FLAG_PLAYER + @player_flag WHERE UID = @u_id; ELSE INSERT INTO #temp_msn_one VALUES(@nickname, @u_id, @apelido_in, @unknown_1, @unknown_2, @unknown_3, @unknown_4, @unknown_5, @unknown_6, @flag_1, @flag_state, @player_flag); END FETCH NEXT FROM MSN_CURSOR INTO @nickname, @u_id, @apelido_in, @unknown_1, @unknown_2, @unknown_3, @unknown_4, @unknown_5, @unknown_6, @flag_1, @flag_state, @player_flag END CLOSE MSN_CURSOR DEALLOCATE MSN_CURSOR ```