Re: Alter User for domain user
- From: "Tom Moreau" <tom@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 7 May 2008 12:47:24 -0400
Any member of sysadmin will always be the dbo inside a DB. Have you tried
creating a separate login that is not a member - directly or indirectly - of
the sysadmin role, and assigning it a default schema?
--
Tom
----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau
"David Walker" <none@xxxxxxxx> wrote in message
news:Xns9A97677D55B76DavidWalker@xxxxxxxxxxxxxxxx
Erland Sommarskog <esquel@xxxxxxxxxxxxx> wrote in
news:Xns9A97520A95F6Yazorman@xxxxxxxxx:
David Walker (none@xxxxxxxx) writes:
I still would like for my username to have a default schema. When I
connect to the server with Windows Authentication, the default schema
is not mapped. (I used to have the dbo role, but that's not the case
any more. I know that a user with the dbo role doesn't have a
default schema.)
All users have a default schema, including dbo. But you can't change
the default schema for dbo to anything else than dbo.
Yes, I know that all users have a default schema; getting a non-dbo
default schema is what I am trying to accomplish. I am NOT the dbo, but
my default schema remains at dbo, reegardless of what I do.
I want my default schema to be what I have set it to with "alter user"
just as in your example below.
I see that the IS group, which I am a member of, has the sysadmin fixed
role on the server. Maybe that's the problem.
My specific userid has the "public" role on the server, and additional
roles on the database where I am trying to change my default schema away
from dbo to something else.
Is the my group membership the source of the problem? Again, I don't
see that it's documented that a member of the sysadmin fixed role can't
have a non-dbo default schema. (Not the dbo role, but sysadmin.)
David Walker
I'm not really sure what your problem may be, as I don't know all your
steps. But I did a test, and I was indeed able to set up a default
schema different from dbo for a Windows login. Here is my test script:
create login [YAZORMAN\Laban] from windows
create user [YAZORMAN\Laban]
go
alter user [YAZORMAN\Laban] with DEFAULT_SCHEMA = thatschema
go
create table hyfs(a int NOT NULL)
create table thatschema.hyfs (b int NOT NULL)
GRANT SELECT ON SCHEMA::thatschema TO [YAZORMAN\Laban]
go
EXECUTE AS LOGIN = 'YAZORMAN\Laban'
go
select * from hyfs -- Lists a result set with a column b
go
REVERT
.
- References:
- Alter User for domain user
- From: David Walker
- Re: Alter User for domain user
- From: Tom Moreau
- Re: Alter User for domain user
- From: David Walker
- Re: Alter User for domain user
- From: Tom Moreau
- Re: Alter User for domain user
- From: David Walker
- Re: Alter User for domain user
- From: Erland Sommarskog
- Re: Alter User for domain user
- From: David Walker
- Alter User for domain user
- Prev by Date: Re: Alter User for domain user
- Next by Date: Re: Alter User for domain user
- Previous by thread: Re: Alter User for domain user
- Next by thread: Re: Alter User for domain user
- Index(es):
Relevant Pages
|