Archive

Posts Tagged ‘sql’

Change Object Owner in SQL Server

September 21st, 2008

When creating a new object in SQL Server while logged in using windows authentication, the object belongs to your username by default. I seem to forget this all the time and end up needing to change the owner of the new object to dbo. This is simple to do, yet I always end up having to search for the exact name of the stored procedure that does this. This post is for my future reference, hopefully it’ll help somebody else too (maybe even you).

To change an object’s owner all you need to do is run:

sp_changeobjectowner 'tablename', 'dbo'

Replace “tablename” with the name of the object you need to change and “dbo” can be changed to another owner if needed… I find that I am usually making the change to dbo.

Hope this helps somebody else.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

SQL Server , ,