Sometime we may face problem that default schema setting is not
working. We changed the default schema
of user but it is still pointing to dbo.
Most common reason is
user role. That is user to which you have assigned you schema belongs to
sysadmin.
And any users with sysadmin role ignore the schema setting.
Solution:
Remove the user from sysadmin role. In sql server management
studio (SSMS) you can get it from:
Security - > <YourUserName> -> Properties - >
Server roles
If this not reason then you must be assigning default schema to user in
correctly. This script can help you:
USE [master]
GO
CREATE LOGIN [Ritesh]
WITH PASSWORD=N'yourpassword',
DEFAULT_DATABASE=[ExactHelp],
CHECK_EXPIRATION=OFF,
CHECK_POLICY=OFF
USE
[ExactHelp]
GO
CREATE USER [Ritesh]
FOR LOGIN [Ritesh]
ALTER USER [Ritesh]
WITH DEFAULT_SCHEMA=[rk]
EXEC sp_addrolemember N'db_owner', N'Ritesh'
How to set default schema of user using sql server management studio
(SSMS):
Step 1: General Tab, Create a new user.
a. Login Name: Write any user name.
b. Password: Write any password
c. Database Default: Choose your default
database.
And any users with sysadmin role ignore the schema setting.
If this not reason then you must be assigning default schema to user in correctly. This script can help you:
Step 1: General Tab, Create a new user.
a. Login Name: Write any user name.
b. Password: Write any password
c. Database Default: Choose your default database.
No comments:
Post a Comment