Tuesday, March 27, 2007

Changing Table Owner in SQL Server

Something I do upon occassion, but not so often that I can remember it.

To change the owner of a table in SQL Server, open query analyzer, make sure you are in the database containing the table whose owner you want to change, and execute the following stored procedure:

sp_changeobjectowner 'TableName' , 'OwnerName'

Where:
TableName is the name of the table
OwnerName is the name of the account you want to assign ownership to

You can actually use this to change the ownership of any object in the database....

No comments: