Home > Back-end >  I cannot find my CREATE VIEW table after refreshing even after "Commands completed successfully
I cannot find my CREATE VIEW table after refreshing even after "Commands completed successfully

Time:02-10

--Creating View to store data for later visualizations

CREATE VIEW PeopleVaccinatedpercent AS

SELECT dea.continent, dea.location, dea.date, dea.population, vac.new_vaccinations
,SUM(cast(new_vaccinations as bigint)) 
OVER (Partition by dea.location ORDER BY dea.location, dea.date) AS RollingPeopleVaccinated
    FROM PortofolioProject..CovidDeaths dea 
    JOIN PortofolioProject..CovidVaccination vac
    ON dea.location = vac.location
    and dea.date = vac.date
    WHERE dea.continent is not null

Commands completed successfully.

After Refreshing I still don't get any result under Views file on the left

CodePudding user response:

First of all, make sure that you have expanded the correct database in the Object Explorer tree view in the left pane and that the SQL editor window is connected to the correct database. (The editor's current database is displayed in the toolbar, just below the main menu.) Being connected to the wrong database (often the master database) is a regular mistake by myself, anyway.

You should be aware that the Object Explorer pane is not automatically updated when you make modifications by executing an SQL query or script. You may update the tree view manually by right-clicking the desired node (in your case the Views node) in the tree and clicking Refresh in the context menu.

Also note the error in the SQL editor, indicated by a red underline. It may be the case that the local IntelliSense cache is corrupted or not updated correctly. You can update it manually. In the main menu, go to Edit->Intellisense->Refresh local cache. Shortly after clicking it, the error message (red underline) should disappear.

CodePudding user response:

You may have created the view in a different schema accidentally , since you did not give a fully qualified name for the view like: "create view myschema.myview ..." If your session is using a different schema as default, this happens a lot ( to me :-))

CodePudding user response:

The simplest wat to test is :

select top 10 * from PeopleVaccinatedpercent

Remember that you created a View, not a Table. In other words it will not be listed under "Tables" in SSMS, but rather "Views"

  • Related