Documentation Index
Fetch the complete documentation index at: https://docs.cloud.cdata.com/llms.txt
Use this file to discover all available pages before exploring further.
Table-valued function support is an experimental feature of the driver. This functionality extends beyond the driver’s core scope of being SQL-92 compliant. As such, performance with these functions may not be optimal.
Table-Valued Function Clauses
CROSS APPLY
The CROSS APPLY operator is used to perform a subquery on each row of a table or resultset produced by a preceding table expression. SyntaxWITH
The WITH clause is used alongside certain table-valued functions to match against constructs within the structure being split (keys, element names, attribute names, etc.) and/or to specify metadata for the columns generated from the function. Example(s)Table-Valued Functions
STRING_SPLIT
Takes each record in the recordset of the preceding table expression, splits the column containing delimiters (input_text) into substrings separated by the delimiter, and returns one record per substring. Syntax- input_text A column whose value you want to parse.
- delimiter The character used to split the value of the column specified in input_text.
JSONTABLE
For each record in the recordset of the preceding table expression, returns one record for each instance of a key in a JSON array (json_content) that matches the key(s) specified in the WITH clause, at the scope specified by the “jsonpath” input. Syntax- json_content A JSON “table” (array of objects). The contents can nest, but this must be a single JSON array, not any other JSON structure, at the root level. The values of every instance of the key(s) provided in the WITH clause are retrievable only for substructures which are immediate children of the root-level JSON array.
- jsonpath An optional JSONPath query defining the scope, within the json_content array, that you want to pull content from. The JSON key(s) identified in the WITH clause must exist at the scope defined in this parameter. This defaults to the JSON root ($). Consider a sample table with a single record, including an ID column and column with JSON content called “JSONColumn” with the following content:
XMLTABLE
For each record in the resultset of the preceding table expression, returns one record for each of the elements and/or attributes in an XML structure (xml_content) that match the tag name(s) and/or attribute name(s) specified in the WITH clause, at the scope specified in the “xpath” input. Syntax- xml_content A column containing an XML structure.
- xpath An optional XPath that specifies the scope within the XML structure at which the driver extracts content matching the tag/attribute name(s) specified in the WITH clause. When extracting the content of sub-elements, the driver can retrieve all content from tags at the root level, (depth 0) immediate children of the root (depth 1), and children of those children (depth 2). When extracting element attribute content, the driver can retrieve all content from tags containing the specified attribute at the root level (depth 0) and from immediate children of root-level elements (depth 1).
- child_type An optional parameter that specifies the part(s) of the parent element (specified in the xpath input) that the column(s) provided in the WITH clause are checked against to identify content. You can supply the following values:
- 0: The column(s) in the WITH clause are checked for matches against the parent element’s attribute names and sub-element tag names.
- 1: The column(s) in the WITH clause are checked for matches against the parent element’s attribute names.
- 2: The column(s) in the WITH clause are checked for matches against the parent element’s sub-element tag names. When not supplied, this defaults to 0.
CSVTABLE
For each record in the resultset of the preceding table expression, reads from a column that contains a CSV table (csv_content) and for each record in that CSV table, returns one record containing the value of the CSV column(s) specified in the WITH clause. Syntax- csv_content A column containing a CSV table.
- delimiter An optional custom delimiter (instead of a comma) which splits the CSV content contained in the csv_content input.