Return to String Function Index
String Function Syntax and Examples
GENKEY( )The GENKEY() function returns a 19-character string that is unique for each unique input set, unless one of the referenced fields is NULL, in which case a null value is returned. Note that the same combination of input field values will return the same output string, so the GENKEY() function will not produce a true primary key unless the input fields are known to be collectively unique.
Warning:
The key produced with the same input set can differ between operating systems, which might affect the cross-platform portability of data and/or scripts.
Syntax:GENKEY( arg1 [ {, argN} ... ] )
where:
The argument(s) can be any referenced field in the script. Up to ten arguments (arg1, arg2, ..., arg10) can be included. The returned key will be unique for each unique, NOT NULL combination of fields specified. If any one input field is NULL, a null value will be returned instead.
Example:input: first-name,last-name,employee-number
IMPORT @sample.dat
{RECORD
{
field1 *,
field2 *,
field3 *\r\n
}
schema1.table1
{
col1 GENKEY(field1, field2, field3)
col2 field1
col3 field2
col4 field3
}}
Results:
schema1.table1.col1 unique string schema1.table1.col2 first-name schema1.table1.col3 last-name schema1.table1.col4 employee-number
Return to String Function Index