Categories:

Data metric functions

STRING_LENGTH_MIN (system data metric function)

Returns the minimum string length of non-NULL values for the specified column in a table. Use this function to detect truncation or unexpectedly short values.

This topic provides the syntax for calling the function directly. To learn how to associate the function with a table or view so it runs at regular intervals, see Associate a DMF.

Syntax

SNOWFLAKE.CORE.STRING_LENGTH_MIN(<query>)

Arguments

query

Specifies a SQL query that projects a single column.

Allowed data types

The column projected by the query must have the VARCHAR data type.

Returns

The function returns a NUMBER value. If all values in the column are NULL, the function returns NULL.

Example

Measure the minimum string length for the code column:

SELECT SNOWFLAKE.CORE.STRING_LENGTH_MIN(
  SELECT
    code
  FROM inventory.tables.products
);