- Categories:
String & binary functions (General)
FORMAT_ STRING_ TEMPLATE¶
Formats a string by substituting placeholders with values, providing type-aware string interpolation.
This function enables templated string construction with typed formatting specifications, similar to formatted string literals in other programming languages.
- See also:
Syntax¶
Arguments¶
template_stringA string containing placeholders that will be replaced with formatted values. Placeholders use curly braces
{}with optional format specifications.value1 [ , value2 ... ]One or more values to substitute into the template string. Values are matched to placeholders in order.
The function supports full type handling for numeric, string, date, and other Snowflake data types.
Returns¶
Returns a VARCHAR containing the formatted string with all placeholders replaced by the corresponding values.
Usage notes¶
- Placeholders in the template string use curly braces
{}and are replaced by the corresponding arguments in order. - Format specifications within placeholders control how values are formatted (for example, number precision, padding, alignment).
- The locale flag
{:L}is not supported and will cause an error if used. - If a placeholder count does not match the number of provided values, the function returns an error.
Examples¶
Basic string interpolation:
Format multiple values:
Format numbers with precision:
Use with table data: