'Create View error in Microsoft SQL server Management

I trying the 'create view' to store data for later visualizations but it gives me an error:

Create View PercentPopulationVaccinated as
select dea.continent, dea.location, dea.date, dea.population, vac.new_vaccinations,
SUM(Cast(vac.new_vaccinations as bigint)) OVER (Partition by dea.location order by dea.location,
dea.date) as RollingPeopleVaccinated
--- , (RollingPeopleVaccinated/population)*100
From PortfolioProject..CovidVaccinations vac
Join PortfolioProject..CovidDeaths dea
    On dea.location = vac.location 
    and dea.date = vac.date
Where dea.continent is not null`

The error says: There is already an object named 'PercentPopulationVaccinated' in the database.

sql


Solution 1:[1]

To overwrite an existing view use

Create or Alter View . . .

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 David Browne - Microsoft