Wednesday, March 21, 2012

How to change db owner for SQL Server 2000 database

Our programmer has left the company and the tables and views were created with his credential as owner.
How do I change the ownership of all the tables and views using the stored procedure - sp_changedbowner?
Instead of typing the individual table and view name to change the db owner, is there a way to change the owner at once?select * from sysobjects where xtype='u'

The above command displays user tables. Get each user table name from sysobjects by using cursor or while loop pass the same as input parameter ot the sp_changedbowner

Try ....|||or from enterprise manager,right click on users and from opened users adjust ur adjustments
good luck|||

Quote:

Originally Posted by papayaya

Our programmer has left the company and the tables and views were created with his credential as owner.
How do I change the ownership of all the tables and views using the stored procedure - sp_changedbowner?
Instead of typing the individual table and view name to change the db owner, is there a way to change the owner at once?


hi dude have a look at this link http://support.microsoft.com/kb/275312|||use [currentdatabase]
go
sp_changedbowner 'yourusername', 'true'
go

This will change the owner of the current database to whatever username you want ( you could put sa in there ) and then remap any alias as well (that's the true).

// John Stone

Quote:

Originally Posted by papayaya

Our programmer has left the company and the tables and views were created with his credential as owner.
How do I change the ownership of all the tables and views using the stored procedure - sp_changedbowner?
Instead of typing the individual table and view name to change the db owner, is there a way to change the owner at once?

|||In SQL Server Management Studio 2005:
1/ Right Click on the Database node
2/Click Properties
3/Select Files
4/There would be a Owner Text Box, change the new Owner Name or browse and select the new Owner.

Shrimant Patel
&
Harith Patel

No comments:

Post a Comment