patternMinor
SQL: transfer database schema
Viewed 0 times
sqldatabasetransferschema
Problem
If i want to transfer schema ownership to another schema i know that i need to use something like:
But how is it different from:
Thanks in advance!
ALTER SCHEMA destinationschema TRANSFER sourceschema.objectname;But how is it different from:
ALTER AUTHORIZATION ON OBJECT::sourceschema.objectname TO destinationschema ;Thanks in advance!
Solution
- ALTER AUTHORIZATION has a more general use for changing ownership of databases, types, keys etc. There is an ENDPOINT example n this MSDN link
ALTER AUTHORIZATION can be used to change the ownership of any entity that has an owner
- ALTER SCHEMA does exactly one thing
Transfers a securable between schemas
In this special case you've highlighted, they do the same thing, There is no difference.
I'll guess that ALTER SCHEMA was added for completeness (eg there is CREATE and DROP why not ALTER) or in preparation for other features (such as renaming a SCHEMA, say)
Context
StackExchange Database Administrators Q#2621, answer score: 8
Revisions (0)
No revisions yet.