Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting Owner in SQL Server??

Status
Not open for further replies.

btturner

Programmer
May 17, 2001
175
US
In a SQL Script, HOW do I set the user's OWNER ID to DBO?

I setup my User, "FRANK" as DBOwner on Database A. Now, whenever FRANK creates a table, the OWNER is FRANK.

FRANK.Customer_Table (I need dbo.Customer_Table ~)

I want the OWNER of the tables to be DBO (type=USER)

thx in advance...
BT

 
First set the "Allow modifications directly ..." option in SQLServer properties.

update sysobjects
set UID = a.IDNumber
from (select UID as IDNumber from sysusers where [name]='dbo') as a
where UID <> a.IDNumber
 
Look fro a previuos posting by our guru, Terry Broadbent at
thread183-482521 suggested the use of sp_changeobjectowner ...
 
Hi

Use sp_changeobjectowner as Terry demonstrates in the thread that sgulsan directed you to.

TGLsoft, updating the system tables directly is one way to change things but the updating of SQL Server system tables directly is generally looked upon as a definite NO, NO !! in the SQL Server community. Usually there is always away to fix/change something(albeit a longer/harder way) without making changes to system tables directly.

Hope this helps

John
 
osjohnm, tell that to sp_mergesubscriptioncleanup. Always when I try to clean up my replication, it remains a lot of system tables, stored procs and views that you can't delete because they are system owned.
So, I delete them directly from sysobjects, and it works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top