Wednesday, August 23, 2006

Changing owner in SQL Server

Given the number of times I've ended up having to search for this and promptly forgotten it 5 minutes later, I thought I'd put this up here so I know where to find it.

In order to change the owner of an object in SQL Server, use something like the following:

sp_changeobjectowner 'Database.dbo.Table', 'newowner'