transfer_view
Move a SQL view to a different schema using ALTER SCHEMA TRANSFER, without rewriting the view's stored definition.
Instructions
Move a SQL view to another schema via ALTER SCHEMA ... TRANSFER OBJECT::....
Works on both Data Warehouses and SQL Analytics Endpoints — no DW-only guard is applied.
CAUTION: ALTER SCHEMA ... TRANSFER moves the view but does not
rewrite the schema name inside the view's stored definition
(sys.sql_modules.definition, OBJECT_DEFINITION()). After a
transfer, the returned (and any subsequent get_view) definition
may still show the old schema name in the CREATE ... AS header,
even though the view now lives in the new schema. This tool does not
rewrite the definition text — doing so would require parsing and
regenerating SQL, which this project deliberately avoids.
Args:
workspace: Workspace name or GUID.
item: Warehouse or SQL endpoint name or GUID.
qualified_name: Current dot-separated qualified view name,
e.g. dbo.vw_sales.
target_schema: Schema to move the view into, e.g. archive.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| item | Yes | ||
| workspace | Yes | ||
| target_schema | Yes | ||
| qualified_name | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||