What Is the Default Schema of Your Login Session in MS SQL Server?
Submitted by: AdministratorWhen you login to a SQL Server and select a database to use, SQL Server will assign your login session a default schema. The schema name can be omitted when you refer to objects in the default schema. Here is what you should remember about default schema:
* The default schema of your login session in the current database is the default schema assigned to the current database level principal - database user.
* If you are referring to an object in the default schema, you do not need to specify the schema name.
* If you are referring to an object outside the default schema, you must specify the schema name.
The tutorial exercise below shows you how to verify your default schema:
-- Login with "ggl_login"
USE GlobalGuideLineDatabase;
GO
Changed database context to 'GlobalGuideLineDatabase'.
PRINT User_Name();
GO
ggl_User
SELECT name, default_schema_name
FROM sys.database_principals WHERE type = 'S';
GO
<pre>name default_schema_name
-------------------- --------------------
dbo dbo
guest guest
INFORMATION_SCHEMA NULL
sys NULL
ggl_User dbo</pre>
The last query shows that the default schema for "ggl_login" in "GlobalGuideLineDatabase" is &qu
Submitted by: Administrator
* The default schema of your login session in the current database is the default schema assigned to the current database level principal - database user.
* If you are referring to an object in the default schema, you do not need to specify the schema name.
* If you are referring to an object outside the default schema, you must specify the schema name.
The tutorial exercise below shows you how to verify your default schema:
-- Login with "ggl_login"
USE GlobalGuideLineDatabase;
GO
Changed database context to 'GlobalGuideLineDatabase'.
PRINT User_Name();
GO
ggl_User
SELECT name, default_schema_name
FROM sys.database_principals WHERE type = 'S';
GO
<pre>name default_schema_name
-------------------- --------------------
dbo dbo
guest guest
INFORMATION_SCHEMA NULL
sys NULL
ggl_User dbo</pre>
The last query shows that the default schema for "ggl_login" in "GlobalGuideLineDatabase" is &qu
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | How To Create a Testing Table with Test Data in MS SQL Server? |
☺ | How To Get the Definition of a View Out of the SQL Server? |
☺ | What Happens If Strings Are Casted into Wrong Code Pages in MS SQL Server? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
☺ | How To Create a Large Table with Random Data for Index Testing in MS SQL Server? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |
☺ | Sybase Interview Questions. |