Documentation

    substring

    Extract part of text, starting at a character position where 1 is the first character. Without a length, it continues to the end of the text.

    Also available as substr.

    Try an expression

    In Formula, enter the expression and set Output type to VARCHAR.

    Expression

    substring('Hello', 2)

    Result

    'ello'

    To use your own data, replace the example values with column names. Keep format strings and other options as written.

    Arguments and types

    substring(string, start, length)
    string
    Text
    start
    Number
    length
    Number
    Supported signatures (2)
    substring(string: VARCHAR, start: BIGINT) → VARCHAR
    substring(string: VARCHAR, start: BIGINT, length: BIGINT) → VARCHAR

    The result type can depend on the input types. See DuckDB for the full argument rules.

    Things to know

    Positions start at 1. Supply a third argument to limit the number of characters.

    If the first argument is missing, the result is NULL.

    Limit the length

    substring('Hello', 2, 2)

    'el'

    Browse textDuckDB documentation

    Function metadata from DuckDB, used under the MIT license.