Intro
This reference guide gives examples of the available functions that can be used in the Add Formula and Group By tiles in Magic ETL. For a complete list, refer to the Functions list inside the Magic ETL Formula Editor, as displayed in the image below.
Aggregate Functions
Function Name | Description | Example |
|---|---|---|
| Returns an approximate result for | |
| Returns the average value of expr. | |
| Returns the correlation coefficient of independent variable x and dependent variable y. It is computed for non-null pairs of values only. For non-null data, it is equivalent to: It is an aggregate function. | |
| Returns a count of the number of non-NULL values of expr. The result is an integer value. It is an aggregate function. | |
| Returns a count of the number of distinct, non-NULL values of expr. The result is an integer value. It is an aggregate function. | |
| Returns the population covariance of independent variable x and dependent variable y. It is computed for non-null pairs of values only. For non-null data, it is equivalent to: It is an aggregate function. | |
| Returns the sample covariance of independent variable x and dependent variable y; the denominator is the sample size minus one. It is computed for non-null pairs of values only. For non-null data, it is equivalent to: It is an aggregate function. | |
| Returns the first non-null value in expr, or | |
| Returns the first value in expr, including | |
| Returns the last non-null value in expr, or | |
| Returns the last value in expr, including | |
| Returns the largest, or maximum, value of expr. It is an aggregate function. | |
| Returns the estimated median value of expr. It is an aggregate function. | |
| Returns the smallest, or minimum, value of expr. It is an aggregate function. | |
| Returns the ntile percentile of expr. It is an aggregate function. | |
| | |
| | |
| Returns the population standard deviation of expr (the square root of It is an aggregate function. | |
| Returns the sample standard deviation of expr (the square root of It is an aggregate function. | |
| Returns the sum of expr. If the return set has no rows, It is an aggregate function. | |
| Returns the population standard variance of expr. It considers rows as the whole population, not as a sample, so it has the number of rows as the denominator. Variance is calculated by working out the mean for the set for each number, subtracting the mean and squaring the result, and finally calculating the average of the resulting differences. It is an aggregate function. | |
| Returns the sample standard variance of expr. The denominator is the number of rows minus one. Variance is calculated by working out the mean for the set for each number, subtracting the mean and squaring the result, and finally calculating the average of the resulting differences. It is an aggregate function. | |
| | |
| | |
| | |
Numeric Functions
Function Name | Description | Example |
|---|---|---|
| Returns the absolute (non-negative) value of X. If X is not a number, it is converted to a numeric type. | |
| Returns the arc cosine of X, that is, the value whose cosine is X. Returns | |
| Returns the arc sine of X, that is, the value whose sine is X. Returns | |
| Returns the arc tangent of X, that is, the value whose tangent is X. | |
| Returns the arc tangent of the two variables X and Y. It is similar to calculating the arc tangent of Y / X, except that the signs of both arguments are used to determine the quadrant of the result. | |
| Returns the “bitwise and” of X and Y. Both arguments must be integers; the result is an integer of the same bit width. | |
| Shifts the binary digits of X left by Y digits. Both arguments must be integers. | |
| Returns the “bitwise nand” of X and Y. Both arguments must be integers; the result is an integer of the same bit width. | |
| Returns the “bitwise nor” of X and Y. Both arguments must be integers; the result is an integer of the same bit width. | |
| Returns the “bitwise not” of X. X must be an integer; the result is an integer of the same bit width. | |
| Returns the “bitwise or” of X and Y. Both arguments must be integers; the result is an integer of the same bit width. | |
| Shifts the binary digits of X right by Y digits. The result is not sign-extended; new leftmost bits are zero. Both arguments must be integers. | |
| Returns the “bitwise xnor” of X and Y. Both arguments must be integers; the result is an integer of the same bit width. | |
| Returns the “bitwise xor” of X and Y. Both arguments must be integers; the result is an integer of the same bit width. | |
| Returns the cube root of X. If X is negative, | |
| Returns the smallest integer value not less than X. Alias for | |
| Returns the smallest integer value not less than X. | |
| Converts numbers between different number bases. Returns a string representation of the number N, converted from base from_base to base to_base. | |
| Converts expr from from_unit to to_unit. expr will be converted to type from_unit and to_unit are strings describing commensurable units in English, e.g. 1. Most SI (Metric) and Imperial units are supported. Imperial units are defined in terms of their SI counterparts. Imperial units of length, area, and mass/weight are mostly agreed upon internationally; the ton is an exception. Units of volume, like the gallon, also differ between the UK and the USA. When such differences arise, USA customary values (e.g. the short ton; 2000 avoirdupois pounds) are used. 2. Units may be written out in full, and optionally pluralized. Metric units may have metric prefixes, and computing units may have metric or binary prefixes. Examples: 3. Units may be abbreviated. Metric and binary prefixes on abbreviated units must also be abbreviated. Abbreviated units are case-sensitive. Examples: 4. Units may be exponentiated using the caret 5. Units may be divided using the forward slash 6. Units may be multiplied using the asterisk 7. Parentheses may be used to affect the order of operations of exponentiation, multiplication, and division. Examples: 8. Units whose names or abbreviations consist of more than one word can be written with an underscore Units must be commensurable to be converted; they must have the same dimensions. There are five supported dimensional values: Time, length, mass, electric current, and information. Units may have a positive, negative, or zero number of dimensions in any of these values. Some units have zero dimensions in all categories; these units are raw quantities like Note that due to the nature of | |
| Returns the cosine of X, where X is given in radians. | |
| Returns the hyperbolic cosine of X. | |
| Returns the cotangent of X. | |
| Computes a cyclic redundancy check value and returns a 32-bit unsigned value. The result is | |
| Returns the value of expr converted to a fixed-precision | |
| Returns the argument X, converted from radians to degrees. This is the converse of the | |
| Returns the kilometer distance between two points on the WGS-84 model of Earth, given as degrees longitude and latitude. Vincenty’s formulae are used to calculate the distance. | |
| | |
| Divides X by Y using integer division. The fractional part of the operation is effectively truncated. | |
| Returns the value of expr converted to a floating-point | |
| Returns the value of e (Euler’s number) as a double-precision floating point. | |
| Returns the value of e (the base of natural logarithms) raised to the power of X. The inverse of this function is If X is | |
| Returns | |
| Returns the largest integer value not greater than X. | |
| Returns the floating point representation of infinity. | |
| Returns the natural logarithm of X; that is, the base-e logarithm of X. If X is less than or equal to 0, or The inverse of this function is | |
| If called with one parameter, this function returns the natural logarithm of X. If X is less than or equal to 0, then If called with two parameters, it returns the logarithm of X to the base B. If B is <= 1 or X <= 0, the function returns If any argument is The inverse of this function (when called with a single argument) is the | |
| Returns the base-10 logarithm of X. | |
| Returns the base-2 logarithm of X. | |
| Returns the value of expr converted to a | |
| Returns the value | |
| Returns the value | |
| Computes the MD5 sum of the given expressions. All arguments are converted to strings before being processed, and a null-character delimiter is added between arguments. The result is returned as a 32 hexadecimal digit string, or | |
| Modulo operation. Returns the remainder of N divided by M. | |
| Returns the floating point representation of | |
| Returns the floating point representation of negative infinity. | |
| Returns the value of π (pi) as a double-precision floating point. | |
| Returns the value of X raised to the power of Y. | |
| This is a synonym for | |
| Returns the argument X, converted from degrees to radians. Note that π radians equals 180 degrees. This is the converse of the | |
| Returns a random | |
| Rounds the argument X to D decimal places. D defaults to 0 if not specified. If the argument X is a fixed decimal type, if equidistant it rounds to the nearest even neighbor. If the argument X is a floating decimal type, if equidistant it rounds up to the nearest neighbor. | |
| Computes the SHA-1 sum of the given expressions. All arguments are converted to strings before being processed, and a null-character delimiter is added between arguments. The result is returned as a 40 hexadecimal digit string, or | |
| Returns the sign of the argument as -1, 0, or 1, depending on whether X is negative, zero, or positive. | |
| Returns the sine of X, where X is given in radians. | |
| Returns the hyperbolic sine of X. | |
| Returns the square root of X. If X is negative, | |
| Returns the tangent of X, where X is given in radians. | |
| Returns the hyperbolic tangent of X. | |
| Returns the number X, truncated to D decimal places. If D is 0, the result has no decimal point or fractional part. | |
| Divides the range [min, max) into equal-width buckets and returns the number of the bucket into which expr falls. Buckets are numbered from 1 to N, where N is the number of buckets. Values that fall outside the range are put in overflow buckets with numbers 0 and N + 1. Be aware that bucket ranges are inclusive of their minimum bound and exclusive of their maximum bound. So | |
Statistical Functions
Function Name | Description | Example |
|---|---|---|
| Returns the F-value of a one-way Analysis of Variance of the samples. At least two samples must be provided, and each sample must have at least two non-null values. Note that a one-way ANOVA on two samples is equivalent to the Student’s t-test (see the See also: | |
| Returns the p-value of a one-way Analysis of Variance of the samples. At least two samples must be provided, and each sample must have at least two non-null values. Note that a one-way ANOVA on two samples is equivalent to the Student’s t-test (see the See also: | |
| Returns the p-value result of a Student’s t-test. Arguments sample1 and sample2 are two numeric columns with at least 2 non-null values each. The tails argument is either 1 or 2, indicating a one- or two-tailed test. The type argument is a number 1 through 3. Type 1 is a paired sample test; for this type of test, values in both sample1 and sample2 must be non-null or be ignored. Type 2 is for two samples with the assumption of equal variance. Type 3 is for two samples without the assumption of equal variance. | |
Window Functions
Window functions calculate a value for each row from a set of related rows, called a partition. Use anOVER clause to define the partition and the order of its rows, for example RANK() OVER (PARTITION BY region ORDER BY sales DESC).
OVER clause. The exception is ROW_NUMBER(), which you can use in the Add Formula tile without an OVER clause to number the rows of the entire input.Function Name | Description | Example |
|---|---|---|
| Returns the ratio of the number of rows with an equal or lesser value to this row to the total number of rows in the partition, according to the window clause. | |
| Returns the rank of this row in the partition, according to the window clause. The rank is 1 for the first row, 2 for the second, and so on. Ties are given the same rank, but no values are skipped. Therefore, if two values are given rank 2, a subsequent, lesser value will be given rank 3. | |
| Returns the value of expr from the row offset rows before this one in the partition, according to the window clause. If offset is not specified, it defaults to 1. If default is not specified, it defaults to | |
| Returns the value of expr from the row offset rows after this one in the partition, according to the window clause. If offset is not specified, it defaults to 1. If default is not specified, it defaults to | |
| Returns the value of expr at the nth row in the partition, according to the window clause. If | |
| Divides the partition into n buckets and returns the number of the bucket for this row, according to the window clause. Buckets are numbered from 1 to n. | |
| Returns the ratio of the number of rows with a lesser rank to this row to the total number of rows in the partition less one, according to the window clause. Equivalent to ( | |
| Returns the rank of this row in the partition, according to the window clause. The rank is 1 for the first row, 2 for the second, and so on. Ties are given the same rank, and values are skipped to account for ties. Therefore, if two values are given rank 2, a subsequent, lesser value will be given rank 4. | |
| Returns the number of the row within a window partition, counting from 1. In Magic ETL, | |
Financial Functions
Function Name | Description | Example |
|---|---|---|
| Calculates the future value of an investment based on these arguments: rate (required): The interest rate per period, expressed as a ratio (e.g. 1% is 0.01). nper (required): The total number of periods. pmt (required): The payment made each period. Can be zero. pv (optional): The present value; how much the investment is worth right now. type (optional): NOTE: Unlike spreadsheet syntax, interest rates cannot be expressed as a percent. They must be expressed as a ratio (usually between 0 and 1). See also: | |
| Calculates the per-period Internal Rate of Return for a set of periodic transactions. ‘guess’ is a best guess of the rate of return. It is optional and the default is 0.1, meaning 10%. It is usually not necessary to specify this value. | |
| Calculates the number of periods for an investment based on constant interest rate, payments, and period duration. Arguments: rate (required): The interest rate per period, expressed as a ratio (e.g. 1% is 0.01). pmt (required): The payment made each period. Can be zero. pv (required): The present value of the loan; the “principal”. fv (optional): The future value; the balance at the end of the entire annuity. If omitted, it is assumed to be 0 (e.g. a loan paid in full). type (optional): NOTE: Unlike spreadsheet syntax, interest rates cannot be expressed as a percent. They must be expressed as a ratio (usually between 0 and 1). See also: | |
| Calculates the Net Present Value for a set of periodic transactions. | |
| Calculates the per-period constant payment made on a loan to achieve the given future value, based on these arguments: rate (required): The interest rate per period, expressed as a ratio (e.g. 1% is 0.01). nper (required): The total number of periods. pv (required): The present value of the loan; the “principal”. fv (optional): The future value; the balance at the end of the entire annuity. If omitted, it is assumed to be 0 (e.g. a loan paid in full). type (optional): NOTE: Unlike spreadsheet syntax, interest rates cannot be expressed as a percent. They must be expressed as a ratio (usually between 0 and 1). See also: | |
| Calculates the present value of an investment based on these arguments: rate (required): The interest rate per period, expressed as a ratio (e.g. 1% is 0.01). nper (required): The total number of periods. pmt (required): The payment made each period. Can be zero. fv (optional): The future value; the balance at the end of the entire annuity. If omitted, it is assumed to be 0 (e.g. a loan paid in full). type (optional): NOTE: Unlike spreadsheet syntax, interest rates cannot be expressed as a percent. They must be expressed as a ratio (usually between 0 and 1). See also: | |
| Attempts to calculate the per-period interest rate of an investment. Not all arguments will have solutions; the result will be nper (required): The total number of periods. pmt (required): The payment made each period. Can be zero. pv (required): The present value of the loan; the “principal”. fv (optional): The future value; the balance at the end of the entire annuity. If omitted, it is assumed to be 0 (e.g. a loan paid in full). type (optional): guess (optional): A best guess of the interest rate. See also: | |
| Calculates the Internal Rate of Return for a set of transactions that is not necessarily periodic. ‘values’ is a set of transaction amounts which must contain at least one negative and one positive value. | |
| Calculates the Net Present Value for a set of transactions that is not necessarily periodic. ‘rate’ is the annualized Internal Rate of Return for the values. ‘values’ is a set of transaction amounts which must contain at least one negative and one positive value. | |
Logic and Control Functions
Function Name | Description | Example |
|---|---|---|
| Returns | |
| Returns | |
| Returns the value of expr converted to | |
| Returns the first non-NULL value in the list, or | |
| When evaluated, produces an error with the given error string. Depending on the transformation settings, this may halt execution entirely. | |
| Returns a column reference expression for the column name in the string str. When a string contains solely a column name, | |
| Formats the expression expr as a string. Due to canonicalization, the string that originally produced the expression and the result string may not be equal. | |
| Attempts to parse the string str as an expression. If there are syntax errors in the expression string, an error is thrown. Due to canonicalization, the string representation of the expression that results from parsing the string may not be equal to the input string. | |
| | |
| | |
| | |
| Expressions are a combination of references, constants, function calls, and other components that describe a value in a context where any and all references can be resolved. All of the following are examples of expressions: The constant integer zero: 0 The constant null: A constant string: The field my_column divided by two: The field my_column in upper case: Expressions are also a data type; a column may be a column of expressions, and an expression may evaluate to an expression. An expression that uses other expressions as inputs or which evaluates to an expression is called a higher-order expression. Refer to the documentation for | |
| Returns the greatest value in the list, or | |
| If test is The return type is the type that best matches both exprTrue and exprFalse. For example, if exprTrue has type | |
| If the evaluation of expr1 does not produce an error, | |
| If expr1 is not | |
| Returns the lowest value in the list, or | |
| Returns | |
String Functions
Function Name | Description | Example |
|---|---|---|
| Returns the length of the given string argument, measured in characters. A multi-byte character counts as a single character. This means that for a string containing five two-byte characters, If the argument is not a string value, it is converted into a string. | |
| Returns the string that results from concatenating the arguments. May have one or more arguments. All arguments are converted to strings. | |
| Returns the value of expr converted to the same type as type_expr. type_expr is not evaluated; it is only used to determine the type to which expr should be converted. In most cases, type_expr should be a column reference. | |
| Decodes the base64-encoded string str. | |
| Returns the string that results from concatenating the arguments, separated by the separator, for the whole group. May have one or more arguments, plus the optional separator. If not set, the separator is the comma character It is an aggregate function. Note: The | |
| Returns str with the start of every word in uppercase and all other characters in lowercase. | |
| Returns the position of the first occurrence of substring substr in string str. If any argument is | |
| | |
| Returns the leftmost len characters from the string str, or | |
| Returns the length of the string str, measured in bytes using the UTF-8 encoding. A multi-byte character counts as multiple bytes. This means that for a string containing five two-byte characters, If str is not a string value, it is converted into a string. If str is | |
| | |
| Returns the string str with all characters changed to lowercase. | |
| Returns the string str, left-padded with the string padstr to a length of len characters. If str is longer than len, the return value is shortened to len characters. | |
| Returns the string str with leading space characters removed. | |
| Returns the length of the string str, measured in bytes using the UTF-8 encoding. A multi-byte character counts as multiple bytes. This means that for a string containing five two-byte characters, If str is not a string value, it is converted into a string. If str is | |
| Performs a pattern match of a string expression str against a pattern pat. The pattern can be an extended regular expression. The optional flags argument is a string that may contain any or all the following characters specifying how to perform matching: | |
| Replaces occurrences in the string str that match the regular str specified by the pattern pat with the replacement string repl, and returns the resulting string. If str, pat, or repl is | |
| Returns the string str with all occurrences of the string from_str replaced by the string to_str. | |
| Returns the string str with the order of the characters reversed, or | |
| Returns the rightmost len characters from the string str, or | |
| Returns the string str, right-padded with the string padstr to a length of len characters. If str is longer than len, the return value is shortened to len characters. | |
| Returns the string str with trailing space characters removed. | |
| Returns the Nth substring of str split by sep. If N is zero or smaller, returns null. If there are fewer than N substrings after str has been split by the given separator, returns empty string. Example: | |
| All sequences of whitespace characters, non-breaking spaces, control characters, and null characters (U+000000), are replaced with a single space ( See also: | |
| Replaces | |
| Returns | |
| Returns a new string consisting of only the digit characters in str in the order they appear. Converse of | |
| Returns | |
| Normalizes str by performing the following operations: 1. 2. Leading and trailing whitespace characters are removed. 3. All other sequences of one or more whitespace characters are replaced with a single space ( 4. All non-whitespace control characters are removed. This is the more thorough version of | |
| Returns str with all digit characters removed. Converse of | |
| Returns | |
| Converts the string str to a descriptive string consisting of a comma-separated list of the official Unicode names of each of its characters. For example, the string See also: | |
| Converts the string str to a hexadecimal string. Each character is described by its 6 hexadecimal digit Unicode codepoint. Each hex number is separated by a space. See also: | |
| Returns the value of expr converted to a | |
| The forms without a len argument return a substring from string str starting at position pos. The forms with a len argument return a substring len characters long from string str, starting at position pos. It is also possible to use a negative value for pos. In this case, the beginning of the substring is pos characters from the end of the string, rather than the beginning. A negative value may be used for pos in any of the forms of this function. By default, the position of the first character in the string from which the substring is to be extracted is reckoned as 1. If any argument is | |
| Returns the substring from src before count occurrences of the delimiter. When invoked with a positive count, everything to the left of the final delimiter (counting from the left) is returned. When invoked with a negative count, everything to the right of the final delimiter (counting from the right) is returned. Performs a case-sensitive match when searching for the delimiter. If any argument is null, returns null. | |
| Encodes the string str as a base64-encoded string. | |
| Returns the string str with all remstr prefixes or suffixes removed. If none of the specifiers | |
| | |
| Returns the string str with all characters changed to uppercase. | |
Date and Time Functions
Function Name | Description | Example |
|---|---|---|
| When invoked with the When invoked with the days form of the second argument, Magic ETL treats it as an integer number of days to be added to expr. | |
| | |
| | |
| Returns the current date. For long-running executions, this is the date that the execution began. | |
| | |
| Synonym for | |
| Synonym for | |
| Returns the current timestamp (date & time). For long-running executions, this is the timestamp of the beginning of the execution. | |
| Returns the current time as a duration since the start of the current day. For long-running executions, this is the time that the execution began. | |
| Converts expr to a calendar date consisting of a year, month, and day. | |
| Performs date arithmetic. The date argument specifies the starting date or datetime value. expr is an expression specifying the interval value to be added or subtracted from the starting date. expr may start with a See also | |
| Formats the date value according to the format string. The language used for the names is controlled by the Locale setting. The options that can be used by | |
| Performs date arithmetic. The date argument specifies the starting date or datetime value. expr is an expression specifying the interval value to be added or subtracted from the starting date. expr is a string; it may start with a | |
| | |
| Returns the number of days between the dates expr1 and expr2, excluding weekends (Saturdays and Sundays). The result is negative if expr1 is after expr2. | |
| Returns the difference between two dates or timestamps. In the MySQL form, the difference is returned in days from the second argument until the first. For example, In the Unit form, the difference is returned in the specified units from the first argument until the second. For example, | |
| Returns the value of expr converted to a | |
| | |
| Returns the name of the weekday for date. The language used for the name is controlled by the Locale setting. | |
| Returns the day of the month for date, in the range 1 to 31. | |
| Returns the day of the week index for the date (1 = Sunday, 2 = Monday,…, 7 = Saturday). These index values correspond to the ODBC standard. This contrasts with | |
| Returns the day of the year for date, in the range 1 to 366. | |
| Returns the value of expr converted to a | |
| Returns the Unix epoch time in milliseconds for the given date or timestamp value. | |
| Returns the value of the provided field extracted from the Date or Timestamp expression. For example, | |
| Given a day number N, returns a The function is not designed for use with dates before the advent of the Gregorian calendar in October 1582. Results will not be reliable since it doesn’t account for the lost days when the calendar changed from the Julian calendar. This is the converse of the | |
| Returns the timestamp value associated with the Unix epoch time given in milliseconds. | |
| Returns a representation of the unix_timestamp argument as a | |
| Parses a Date & Time value out of the given string using a fuzzy algorithm. This function is able to parse many formats in many languages, and is often able to ignore mistakes in formatting. The tradeoff is that it may ignore parts of a string that it does not recognize, or misinterpret ambiguous formats. Day-month-year vs. month-day-year ambiguity is resolved by referring to the Locale setting. For country=US, or where country is empty and language=en, month-day-year is assumed. All other locales assume day-month-year. NOTE: This is the same date parsing algorithm used by the String to Timestamp converter in the first version of Magic ETL. | |
| Returns the hour for time. The range of the return value is 0 to 23. | |
| Takes a date or datetime value and returns the corresponding value for the last day of the month. | |
| For debugging purposes. Returns the Locale setting for this context. This setting controls the behavior of functions like | |
| Returns the microseconds from the datetime expression expr as a number in the range from 0 to 999999. | |
| Returns the milliseconds from the datetime expression expr as a number in the range from 0 to 999. | |
| Returns the minute of the datetime argument, in the range 0 to 59. | |
| Returns the month for date in the range 1 to 12 for January to December. | |
| Returns the full name of the month for date. The language used for the name is controlled by the Locale setting. | |
| Synonym for | |
| Periods are quantities of calendar years, months, and days. They are primarily useful for adding to dates and timestamps, as they are not supported outside of Magic ETL. Periods can be written in expressions in two ways. One is by wrapping a period string in the Periods can be converted to durations, but this conversion is approximate. There is no way to precisely represent one month in terms of seconds. Periods may also be converted to string, which uses the format described above. Finally, periods may be converted to and from numeric types. Those conversions simply convert to and from a number of days. | |
| Adds N months to period P. P is an integer in the format YYMM or YYYYMM. If P contains a two-digit year, values from 00 to 69 are converted to from 2000 to 2069, while values from 70 are converted to 1970 upwards. Returns an integer value in the format YYYYMM. | |
| Returns the number of months between periods P1 and P2. P1 and P2 can be in the format YYMM or YYYYMM, and are integer values. If P1 or P2 contains a two-digit year, values from 00 to 69 are converted to from 2000 to 2069, while values from 70 are converted to 1970 upwards. | |
| Returns the quarter of the year for date, in the range 1 to 4. Returns | |
| Returns the seconds argument, converted to hours, minutes, and seconds, as a | |
| Returns the second for a given time in the range 0 to 59. | |
| This is the inverse of the The format that can be used by | |
| When invoked with the The second form allows the use of an integer value for days. In such cases, it is interpreted as the number of days to be subtracted from the date or datetime expression expr. | |
| | |
| Synonym for | |
| For debugging purposes. Returns the Locale setting for the DataFlow or, if not set, the customer. This setting controls the behavior of functions like | |
| For debugging purposes. Returns the time zone setting for the DataFlow or, if not set, the customer. This setting controls the behavior of many date- and time-related functions, like | |
| Converts expr to a duration ( | |
| This is used like the | |
| Returns the time argument, converted to seconds. | |
| | |
| Converts expr to a timestamp ( | |
| Truncates timestamp to the given precision, or to the day if no precision is specified. The result is of type Millennium: Century: Year: ISO Year: Quarter: Month: Same weekday as first day of year: Same weekday as first day of ISO year: Same weekday as first day of month: First day of week according to current Locale setting: Day (the default): Hour: Minute: Second: Millisecond: Microsecond: | |
| Given a date date, returns the number of days since the start of the current calendar. The function is not designed for use with dates before the advent of the Gregorian calendar in October 1582. Results will not be reliable since it doesn’t account for the lost days when the calendar changed from the Julian calendar. This is the converse of the | |
| | |
| | |
| For debugging purposes. Returns the time zone setting for this context. This setting controls the behavior of many date- and time-related functions, like | |
| If called with no argument, returns a Unix timestamp (seconds since The inverse function of | |
| This function returns the week number for date. The two-argument form of | |
| Returns the weekday index for date (0 = Monday, 1 = Tuesday,… 6 = Sunday). This contrasts with | |
| | |
| Returns the year for the given date, in the range 0 to 9999. | |
| Returns year and week for a date. The mode argument works exactly like the mode argument to | |
System Functions
The time zone and locale settings for a DataFlow (@@TZ, @@SYSTEM_TZ, @@LOCALE, and @@SYSTEM_LOCALE) are also available as system functions. They are listed under Date and Time Functions.
Function Name | Description | Example |
|---|---|---|
| The system ID of the action executing the statement. This is different from | |
| The user-provided name of the action executing the statement. This is different from | |
| The numeric ID of the DataFlow executing the statement, or | |
| The user-provided name of the DataFlow executing the statement, or | |
| The execution engine, e.g. | |
| The numeric ID of the current DataFlow execution, or null if the statement is not being executed as part of a DataFlow execution. Note that these IDs are not sequential for a given DataFlow, but are guaranteed to be larger than the IDs of executions started earlier. | |
| | |

