The following xml demonstrates how to copy a view definition:
<views> <view selection="included"> <name>deptsals</name> <database>MyDb</database> </view> </views>
Set the selection as "included" to copy the view definition deptsals from the source system to the target system using the name of the view and the database where the view exists on the source system.
- If the object being copied does not exist on the target database, it is created on the target database. If the object does exist on the target database, the object is overwritten – unless the overwrite_existing_objects property is set to false. In that case, a create time error is generated.
- You cannot relocate or rename views.
- If the table names in the view definition are not fully qualified, those tables must exist in the database having the same name as the source view database to avoid an error.
For example, the following view definition contains a non-fully qualified view name and table name:
CREATE VIEW deptsals AS SELECT department_number AS department FROM employee HAVING salary_amount < 36000;
- If the table on which the view is created does not exist on the target, or is not being moved as part of the job, an error results when attempting to create the view definition on the target system.
- Attempting to rename or relocate referenced tables results in an error when you create the view definition on the target system.