GETQUERYBANDVALUE_UDF

This is a deprecated version of the SnowConvert documentation, please visit the official site HERE.

This is the user-defined function (UDF) overloaded with three parameters.

Definition

Retrieves the value associated with a name inside the name-value pairs of the transaction, session, or profile query band.

GETQUERYBANDVALUE_UDF(QUERYBAND VARCHAR, SEARCHTYPE FLOAT, SEARCHNAME VARCHAR)

Parameters

QUERYBAND VARCHAR

The query band which can be a concatenation of transaction, session, and profile query bands.

SEARCHTYPE FLOAT

The level of the pairs that will be searched for a match.

0 = Any.

1 = Transaction.

2 = Session.

3 = Profile.

SEARCHNAME VARCHAR

The name key to search in the pairs.

Returns

The value associated with the name key at the specific level or null if not found.

Usage example

Input:

SELECT GETQUERYBANDVALUE_UDF('=T> account=Matt;user=Matt200; =S> account=SaraDB;user=Sara;role=DbAdmin;', 0, 'account');
SELECT GETQUERYBANDVALUE_UDF('=T> account=Matt;user=Matt200; =S> account=SaraDB;user=Sara;role=DbAdmin;', 2, 'account');
SELECT GETQUERYBANDVALUE_UDF('=T> account=Matt;user=Matt200; =S> account=SaraDB;user=Sara;role=DbAdmin;', 0, 'role');
SELECT GETQUERYBANDVALUE_UDF('=T> account=Matt;user=Matt200; =S> account=SaraDB;user=Sara;role=DbAdmin;', 1, 'role');

Output:

      Matt
      SaraDB
      DbAdmin
      NULL

Migration example

Input:

SELECT GETQUERYBANDVALUE('=T> account=Matt;user=Matt200; =S> account=SaraDB;user=Sara;role=DbAdmin;', 0, 'account')

Output:

WITH
--** MSC-WARNING - MSCEWI2078 - THE EXPAND ON CLAUSE FUNCTIONALITY IS TRANSFORMED INTO A CTE BLOCK **
ExpandOnCTE AS
(
SELECT
PUBLIC.EXPAND_ON_UDF('ANCHOR_SECOND', VALUE, duration) /*** MSC-WARNING - MSCEWI1020 - CUSTOM UDF 'EXPAND_ON_UDF' INSERTED. ***/ bg
FROM
project,
TABLE(FLATTEN(PUBLIC.ROW_COUNT_UDF(PUBLIC.DIFF_TIME_PERIOD_UDF('ANCHOR_SECOND', duration) /*** MSC-WARNING - MSCEWI1020 - CUSTOM UDF 'DIFF_TIME_PERIOD_UDF' INSERTED. ***/) /*** MSC-WARNING - MSCEWI1020 - CUSTOM UDF 'ROW_COUNT_UDF' INSERTED. ***/))
)
SELECT NORMALIZE emp_id,
duration
FROM
project,
ExpandOnCTE;

Last updated