SQL: Finding the current default schema in a SQL Server session
Each SQL Server user has a default schema. This the used in several ways. If I execute code like this:
CREATE TABLE Blah
(
...
);
I haven’t specified where that table will be created. People seem to assume it will end up in the dbo schema i.e. the table will be dbo.Blah but that’s not the case. It depends upon the user’s default schema. If that’s Sales, then the table Sales.Blah would be created instead.
2019-12-03




