Represents a SQL/XML query in the definition of a trigger, a procedure or a function.
The Insert SQL/XML Macro tool opens a selection dialog box where you choose a global element from an XML model. The XML model must be open in the workspace, mapped to a PDM, and have the SQL/XML extension file attached. Click OK in the dialog box and the SQLXML macro is displayed in the definition code, with the code of the XML model (optional) and the code of the global element.
The Macros tool, where you select .SQLXML( ) in the list. The SQLXML macro is displayed empty in the definition code. You must fill the parentheses with the code of an XML model (optional), followed by :: and the code of a global element. The XML model, from which you choose a global element, must be open in the workspace, mapped to a PDM, and have the SQL/XML extension file attached.
After generation, the SQLXML macro is replaced by the SQL/XML query of the global element.
.SQLXML(code of an XML model::code of a global element)
Note: the code of an XML model is optional.
In a trigger for the table EMPLOYEE, the following macro:
.SQLXML(CorporateMembership::DEPARTMENT)
generates the following trigger script:
select XMLELEMENT( NAME "Department", XMLATTRIBUTES (DEPNUM,DEPNAME), (select XMLAGG ( XMLELEMENT( NAME "Employee", XMLATTRIBUTES (DEPNUM,EMPID,FIRSTNAME,LASTNAME)) ) from EMPLOYEE where DEPNUM = DEPNUM)) from DEPARTMENT