c037779295b43df4381e44e052761b8f4e94d070
15-dot-4-Expression-Functions.md
| ... | ... | @@ -0,0 +1,42 @@ |
| 1 | +#15.4 Expression Functions |
|
| 2 | + |
|
| 3 | +### Functions |
|
| 4 | + |
|
| 5 | +As you may have noticed, we can use some aggregate functions in expressions. In order to prevent SQL injection, only a limited set of SQL functions are turned on by default. |
|
| 6 | + |
|
| 7 | +- avg(OrderID) produces the average of all OrderID values. |
|
| 8 | + |
|
| 9 | +- cast(OrderID, AS DATATYPE) ``e.g. "cast([OrderID] as varchar)"`` Converts a value from one data type to another. This should only be done when you do not want to make a permanent change to the data type, such as converting numeric to strings and concatenating them. |
|
| 10 | + |
|
| 11 | +- convert (DATATYPE, [OrderID]) ``e.g. "convert(varchar, [OrderID])"`` |
|
| 12 | + |
|
| 13 | +More information about using these functions can be found [[here|http://msdn.microsoft.com/en-us/library/aa226054(v=sql.80).aspx]] and [[here|http://dev.mysql.com/doc/refman/5.5/en/cast-functions.html#function_cast]] |
|
| 14 | + |
|
| 15 | +- count(OrderID) produces a count of all OrderID values. |
|
| 16 | + |
|
| 17 | +- distinct(OrderID) produces a list of all distinct OrderID values. |
|
| 18 | + |
|
| 19 | +- isnull(OrderID, x) checks to see if there is a null value in OrderID and replaces it with ‘x’. |
|
| 20 | + |
|
| 21 | +- length(OrderID) returns the length of a string. Length is used with an Oracle db. If you’re using SQL, see len(OrderID). |
|
| 22 | + |
|
| 23 | +- len(OrderID) returns the length of a string. Len is used with a SQL db. If you’re using Oracle, see length(OrderID). |
|
| 24 | + |
|
| 25 | +- max(OrderID) produces the maximum OrderID value within a given range. |
|
| 26 | + |
|
| 27 | +- min(OrderID) produces the minimum OrderID value within a given range. |
|
| 28 | + |
|
| 29 | +- round(OrderID, x) takes a decimal value and rounds it to x digits. |
|
| 30 | + |
|
| 31 | +- sum(OrderID) produces the sum of all OrderID values. |
|
| 32 | + |
|
| 33 | +It is possible to enable other SQL functions or write new functions. Please see this link to our knowledge base for instructions: |
|
| 34 | + |
|
| 35 | +http://www.izenda.com/Site/CodeSample/CodeSample.aspx?setting=ExtendedFunctions |
|
| 36 | + |
|
| 37 | + |
|
| 38 | +--- |
|
| 39 | + |
|
| 40 | +[[15.0 Expressions in Izenda]] |
|
| 41 | + |
|
| 42 | +[[UserGuides]] |
|
| ... | ... | \ No newline at end of file |