User Guide > Using the Any-Any Transformation Editor > Using the Transformation Editor > Working with the Transformation Editor XQuery Tab
 
Working with the Transformation Editor XQuery Tab
The XQuery tab that is included as part of the Transformation Editor is an excellent tool to use for reviewing the XQuery code that will be generated by the transform that you are defining. After adding a few operations and connections to your transform, you can preview the code to get a feel for how the transform will act when it is executed. As you get more comfortable with the code that TDV will generate for your transform, you can design models that produce the results that you need.
Queries that are part of your transform have generated SQL that you can review. TDV optimizes the SQL so that it can be pushed for execution at the database level.
Topics included in this section are:
Viewing and Copying the XQuery Code From Your Transform
Validating the Transform XQuery Code Using Studio
Viewing and Copying the XQuery Code From Your Transform
Looking at the code on the XQuery tab of the Transformation Editor can help you understand the code that TDV generates for the transform that you are defining. If the source code generated by the Transformation Editor is inadequate for your unique situation, you can copy the XQuery source of the transform into a newly created XQuery Procedure.
To view and copy the XQuery code
1. Open the Transformation Editor.
2. Save your transform.
3. Select the XQuery tab.
4. Scroll up and down to review the code.
5. Select a portion or all of the code and copy it (using ctrl+c).
Validating the Transform XQuery Code Using Studio
Copy and paste the XQuery code into a different Studio procedure editor to validate that what the Transformation Editor is generating is valid.
This validation method can be used to move your transform code out of the confines of the Transformation Editor code generator so that you can define your transform using XQuery code directly.
To validate the XQuery code that is created by the Transformation Editor
1. Open your transform.
2. Select the XQuery tab.
3. Use your mouse to highlight and select all of the code text.
4. Copy the selected text.
5. From the Studio resource tree, right-click Shared.
6. Select New XQuery Procedure.
7. Name your new procedure.
8. Select all of the text in the XQuery tab and paste your transform XQuery code.
9. Save the procedure.
10. Execute the procedure.
11. If errors are generated, return to your transform and attempt to resolve them using the Transformation Editor.