How can you set the default schema for the table in Microsoft SQL Server?
For example, I would like to use the query
SELECT * from Table1
instead of
SELECT * from Schema1.Table1
Shathana. S.R. Answered question April 21, 2023
							The default schema in SQL Server is a user specific functionality.
You can set the default schema in a SQL Server with the T-SQL as shown below.
USE [DPDatabaseName]; ALTER USER [YourUserName] WITH DEFAULT_SCHEMA = [YourSchemaName];
For example, if your database name is TestDB , user name is “developerpublish” and schema is “website”, your query would look like this
USE TestDB; ALTER USER developerpublish WITH DEFAULT_SCHEMA = website;
Also note that the value of DEFAULT_SCHEMA is ignored if the user is a member of the sysadmin fixed server role.
ginktage Answered question February 5, 2023
				