I'm using MSSQL Studio and am connected to a SQL Server 2014 with my windows credentials (DOMAIN\user).
I just created a new view and wondered why another user could not find it:
CREATE VIEW abc AS SELECT 1 AS a
Unexpectedly this view was not created in dbo
schema but in DOMAIN\user
.
To create the view in dbo
schema I needed to execute:
CREATE VIEW dbo.abc AS SELECT 1 AS a
This kind of surprises me, for I've been creating views for ages without explicit schema and have always been created in dbo
– since today.
What could be the reason?
Check under Security -> Login -> Your User - User Mapping. For all selected maps your "Default Schema" should be changed to dbo.