'View created in SQL Server Management Studio but not visible in "Views" section
I created a view in SQL Server Management Studio 18 and I am getting the following message: "Commands completed successfully." which I guess means that the view has been created. However I cannot see the view in the views section of the database in the Object Explorer.
I confirmed that the view has been created by running the query again and i got an error that the object already exists.
This is the code I used to create the view:
    GO 
    CREATE VIEW VIEW_1 as SELECT dea.continent, dea.location, dea.date, dea.population, vac.new_vaccinations, SUM(cast(vac.new_vaccinations as INT)) OVER (PARTITION BY dea.location ORDER BY dea.location,dea.date) AS rolling_new_vax 
    FROM [Portfolio Project _1]..['covid vaccinations$'] vac JOIN [Portfolio Project _1]..['covid deaths$'] dea 
    ON vac.location =dea.location AND vac.date = dea.date 
    WHERE dea.continent IS NOT NULL AND dea.location = 'Canada'
Solution 1:[1]
I know this isn't the most fun answer but I had the same error on the same guided project. I saved the file then closed out of SSMS, reopened the file, deleted the Create View statement, retyped the statement, executed the query, refreshed the views folder and it worked.
Solution 2:[2]
if you add filter with name of your view does it show?
try this code to see the views in your DBs
SELECT 
OBJECT_SCHEMA_NAME(o.object_id) schema_name,o.name
FROM
sys.objects as o
WHERE
o.type = 'V';
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 | klaubbs | 
| Solution 2 | Pedram Salamati | 
