Collections:
Default Schema of Your Login Session in SQL Server
What Is the Default Schema of Your Login Session in SQL Server?
✍: FYIcenter.com
When 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 tutorial exercise below shows you how to verify your default schema:
-- Login with "fyi_login" USE FyiCenterData; GO Changed database context to 'FyiCenterData'. PRINT User_Name(); GO Fyi_User SELECT name, default_schema_name FROM sys.database_principals WHERE type = 'S'; GO name default_schema_name -------------------- -------------------- dbo dbo guest guest INFORMATION_SCHEMA NULL sys NULL Fyi_User dbo
The last query shows that the default schema for "fyi_login" in "FyiCenterData" is "dbo".
Â
2016-10-22, 1016👍, 0💬
Popular Posts:
How To Use DATEADD() Function in SQL Server Transact-SQL? DATEADD() is a very useful function for ma...
How to set database to be READ_ONLY in SQL Server? Databases in SQL Server have two update options: ...
How To Get Year, Month and Day Out of DATETIME Values in SQL Server Transact-SQL? You can use DATEPA...
How To Convert Character Strings into Numeric Values in SQL Server Transact-SQL? Sometimes you need ...
What is SQL Server Transact-SQL (T-SQL)? SQL Server Transact-SQL, also called T-SQL, is an extension...