Examples: Using UDTs
These examples show the use of user-defined types (UDTs) in various situations.
- Example: Comparisons between UDTs and constants
Suppose that you want to know which products had total sales of over US $100 000.00 in the U.S. in the month of July 1998.
- Example: Casting between UDTs
Suppose that you want to define a user-defined function (UDF) that converts Canadian dollars to U.S. dollars.
- Example: Comparisons involving UDTs
Suppose that you want to know which products had higher sales in the U.S. than in Canada and Germany for the month of March 2003.
- Example: Sourced UDFs involving UDTs
Suppose that you have defined a sourced user-defined function (UDF) on the built-in SUM function to support SUM on Euros.
- Example: Assignments involving UDTs
Suppose that you want to store the form that is filled out by a new applicant into the database.
- Example: Assignments in dynamic SQL
If you want to store the application form using dynamic SQL, you can use parameter markers.
- Example: Assignments involving different UDTs
Suppose that you have defined these sourced user-defined functions (UDFs) on the built-in SUM function to support SUM on U.S. and Canadian dollars.
- Example: Using UDTs in UNION
Suppose that you want to provide your U.S. users with a query to show the sales of every product of your company.
Parent topic:
User-defined distinct types