Hello there
I don't member of DBO owners of my database on sql server
After i've created new table it has my name as an owner
How can i change the owner?
' 03-5611606
' 050-7709399
: roy@.atidsm.co.ilUse sp_changeobjectowner
Markus|||sp_changedbowner
Changes the owner of the current database.
Syntax
sp_changedbowner [ @.loginame = ] 'login'
[ , [ @.map = ] remap_alias_flag ]
Arguments
[@.loginame =] 'login'
Is the login ID of the new owner of the current database. login is sysname,
with no default. login must be Microsoft SQL ServerT login or a Microsoft
Windows NT user that already exists. login cannot become the owner of the
current database if it already has access to the database through an
existing alias or user security account within the database. To avoid this,
drop the alias or user within the current database first.
[@.map =] remap_alias_flag
Is the value true or false, which indicates whether existing aliases to the
old database owner (dbo) are mapped to the new owner of the current database
or dropped. remap_alias_flag is varchar(5), with a default of NULL,
indicating any existing aliases to the old dbo are mapped to the new owner
of the current database. false indicates that existing aliases to the old
database owner are dropped.
Return Code Values
0 (success) or 1 (failure)
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:ODXgIbn9FHA.2192@.TK2MSFTNGP14.phx.gbl...
> Hello there
> I don't member of DBO owners of my database on sql server
> After i've created new table it has my name as an owner
> How can i change the owner?
> --
>
>
> ' 03-5611606
> ' 050-7709399
> : roy@.atidsm.co.il
>|||Hi Roy
Do you want to change the owner of the database (as your subject suggests)
or the owner of the tables?
I will assume, based on your message, that you want to change the table
owner, or have the table owner be 'dbo'.
DBO is a user name. It is a member of a role called db_owners. Members of
the db_owners role can do everything that the owner of the database can do,
within the database.
Other users can also be members of the db_owners role, but their user will
be something other than DBO. That sounds like your situation.
Normally, when a user creates a table, the owner of the table is the user
name of whoever creates it. So if DBO creates the table, it is owned by DBO,
if Roy, who might be a member of db_owners role, creates a table, it is
owned by Roy.
Members of the db_owners role do have a special permission that they can
create tables owned by other users:
CREATE TABLE dbo.mytable
(....)
Or, members of db_owners role can change the owner of existing objects.
EXEC sp_changeobjectowner 'roy.mytable', 'dbo'
Please see more details about this command in the Books Online., You might
also want to read up about login names and user names.
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:ODXgIbn9FHA.2192@.TK2MSFTNGP14.phx.gbl...
> Hello there
> I don't member of DBO owners of my database on sql server
> After i've created new table it has my name as an owner
> How can i change the owner?
> --
>
>
> ' 03-5611606
> ' 050-7709399
> : roy@.atidsm.co.il
>
Showing posts with label member. Show all posts
Showing posts with label member. Show all posts
Subscribe to:
Posts (Atom)