donderdag 25 november 2010

Change owner of Database Objects Schema and Role

Do you also always forget how to do the simple things? I do.

Today I needed to change the owner of database schemas and roles after migrating databases from SQL 2000 to SQL 2008 and again did forget how to do this in T-SQL. To never forget again and for those who are looking for the same:

Change Schema owner:
ALTER AUTHORIZATION ON SCHEMA::[<schemaname>] TO [<newowner>]

Change Role owner:
ALTER AUTHORIZATION ON ROLE::[<rolename>TO [<newowner>]

Geen opmerkingen: