User Guide > Definition Sets > Creating a Definition Set > Creating a SQL Definition Set
 
Creating a SQL Definition Set
You can create a SQL definition set that defines parameters, exceptions, and constants. You can then refer to the parameters, exceptions, and constants in a definition set from any procedure or view in TDV, and also share the definition set with any user who has appropriate privileges in the system. You can type the SQL definitions directly, or import existing definitions.
To create a SQL definition set
1. Follow the steps in Creating a Definition Set, choosing SQL as the type of definition set.
See SQL Definition Set Editor for information about the SQL definition set editor toolbar buttons and panel features.
2. Select the Types tab in the editor.
You can create type definitions for a SQL definition set in one of two ways:
You can add new type definitions one at a time.
You can upload an existing definition set. You can include both SQL-type definitions and XML-type definitions in a SQL-type definition set.
3. Add one or more new definitions by following these steps:
a. Click the Add button and select one of the data types from the menu.
Studio adds a definition of the specified type, giving it the default name NewTypeDefinition. For example, if you select String > CHAR, the new definition would look like this:
b. Rename the newly added type definition by clicking in the Name field and typing the new name. Or, you can right-click and select Rename from the menu.
c. If the type is Complex and you have created multiple xmlElements, you can move or indent a type definition by using the navigation arrows in the editor’s toolbar.
d. Repeat to create as many type definitions as you need.
e. Save the definition set.
4. Optionally, add an existing definition set from the Studio resource tree by following these steps:
a. Click the Add button and select Browse from the menu.
The Add Definition Type window opens.
b. In the resource tree in the left pane, select a definition set.
c. In the right pane, select the definition set.
The qualified name for the selected definition set appears in the Type field at the bottom if the window.
d. Click OK.
e. Back in the new definition set panel, rename the newly added definition set by clicking in the Name field and typing the new name. Or, you can right-click and select Rename from the menu.
f. Expand the definition set and edit it as necessary. You can:
Use the right-click menu to rename, change the data type or value, or delete a type definition.
Move or indent a type definition using the navigation arrows in the editor’s toolbar.
g. Save the definition set.
5. To add exceptions, select the Exceptions tab, click the Add button, and add exceptions the same way you added types.
The Exceptions example below displays some exceptions available in the system.
6. To add constants, select the Constants tab, click the Add button, and add constants the same way you added types and exceptions.
The Constants panel with an example constant is shown below.
7. To supply a value for a constant:
a. Select the constant.
b. Right-click the Value field and select Change Value.
c. In the input dialog, supply a value for the constant, and click OK.
8. Optionally, click the Info tab to review information about this definition set or supply an annotation for the definition set.
9. Save the definition set.
You can now reference the SQL definition set and all of the data types contained in the definition set from stored procedures, XQuery procedures, and XSLT procedures. See Using a SQL Definition Set.