Wednesday, March 7, 2012

Owership of database tables

Dear all,
I have a database in SQL server 2000. In Ent. Manager, it shows that the
"Owner" of the tables in this database is "dbo". Is it possible to change the
owner to one of the database user in this database?
Thanks in advance.
Ivan
Hi
If the user is called Albert:
EXEC sp_changedbowner 'Albert'
Just be aware, once a user is the owner of an object, you can not remove the
user until a new owner is set.
Regards
Mike
"Ivan" wrote:

> Dear all,
> I have a database in SQL server 2000. In Ent. Manager, it shows that the
> "Owner" of the tables in this database is "dbo". Is it possible to change the
> owner to one of the database user in this database?
> Thanks in advance.
> Ivan
|||Continued...
To change the owner of an object like a table or a SP:
EXEC sp_changeobjectowner 'authors', 'Albert'
If you change the owner of a View or Stored Procedure, it does not change
the actual script that is stored, so when you script the SP or view out, the
old owner is still shown on the Create statement.
Regards
Mike
"Mike Epprecht (SQL MVP)" wrote:
[vbcol=seagreen]
> Hi
> If the user is called Albert:
> EXEC sp_changedbowner 'Albert'
> Just be aware, once a user is the owner of an object, you can not remove the
> user until a new owner is set.
> Regards
> Mike
> "Ivan" wrote:
|||Thanks for your help!
"Mike Epprecht (SQL MVP)" wrote:
[vbcol=seagreen]
> Continued...
> To change the owner of an object like a table or a SP:
> EXEC sp_changeobjectowner 'authors', 'Albert'
> If you change the owner of a View or Stored Procedure, it does not change
> the actual script that is stored, so when you script the SP or view out, the
> old owner is still shown on the Create statement.
> Regards
> Mike
> "Mike Epprecht (SQL MVP)" wrote:

No comments:

Post a Comment