Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Owner of table

Author  Topic 

TRACEYSQL
Aged Yak Warrior

594 Posts

Posted - 2007-12-22 : 17:08:23
If i look at a database and do view taskpad and see that the table has an owner

TABLEA
OWNER MgtEn

If i want to change the owner i do the following:
use TABLEA exec sp_changedbowner 'MgtEnNew'

If i add
TABLEB
OWNER sa

I can add Owner in SQL Logins and do dbo owner
then i see user is the owner

I do not understand why you can have the TABLE OWNER be the login or this should be sa.

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2007-12-22 : 17:49:51
Not sure I follow...

You can have 'sa' be the database owner, or you can assign any login you like to be the db owner.

A table owner within the database can also be either "dbo" or the specific login of who created it, depending on how the table itself was created.

I am not sure I follow why you would say "use TableA exec sp_changedbowner 'MgtEnNew'"

The db owner, may be different than the owner of a table.

If you add a login for "MgtEnNew" you can create the table

Create Table [database].[MgtEnNew].[TableName]

to assign table ownership to that user.




Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-12-22 : 21:15:25
You can't change table owner with sp_changedbowner, and sa will never be table owner.
Go to Top of Page

TRACEYSQL
Aged Yak Warrior

594 Posts

Posted - 2007-12-23 : 06:56:27
It was a sharepoint site coming in and i just gave the sharepoint login dbo_owner and the site failed.
so i had to make database owner be the sharepoint login.

If i want my developers to have control and create tables i give them db_owner. But if they want them to be dbo they would have to do create table dbo.mytable otherwise it be mylogin.mytable

So confusing.
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-12-23 : 16:52:29
That's the way sql works. By the way, member of db_ddladmin can create table. So not necessary to give user dbo rights.
Go to Top of Page

TRACEYSQL
Aged Yak Warrior

594 Posts

Posted - 2007-12-24 : 08:20:50
Thanks for the help.
Go to Top of Page
   

- Advertisement -