Chapter 6 Building Triggers and Procedures


Creating SQL/XML Queries with the Wizard

You can use the SQL/XML Wizard to insert a SQL/XML query in the definition of a trigger, stored procedure, or function to store or retrieve data, in an XML format, from relational databases supporting SQL/XML. The wizard, allows you to select tables and views from a PDM to build a mapped XML model. This XML model (which does not appear in the workspace) is used to generate SQL/XML queries from global elements.

Steps To insert a SQL/XML query in the definition of a trigger:

  1. Open the trigger property sheet, click the Definition tab and position the cursor in the trigger definition where you want to insert the SQL/XML query:
  2. Click the SQL/XML Wizard tool to launch the wizard at the Tables and Views Selection page:
  3. Select the tables and views that you want to include in your query and click Next to go to the XML Hierarchy Design page:


    On this tab, you construct the XML hierarchy that you want to generate:

  4. You can build your XML hierarchy using the following techniques:

  5. When you have finished building your hierarchy, click Next to go to the Query tab:
  6. Review your query and click Back, if necessary, to make revisions in your hierarchy. When you are satisfied, click Finish to close the wizard and insert the SQL/XML query in the trigger definition
  7. [optional] Add code to complete the SQL/XML query:
  8. Click OK to close the trigger property sheet:

 


Copyright (C) 2008. Sybase Inc. All rights reserved.