A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.snowflake.com/en/sql-reference/functions/try_to_boolean below:

Website Navigation


TRY_TO_BOOLEAN | Snowflake Documentation

TRY_TO_BOOLEAN

A special version of TO_BOOLEAN that performs the same operation (that is, converts an input expression to a Boolean value), but with error-handling support. If the conversion can’t be performed, TRY_TO_BOOLEAN returns a NULL value instead of raising an error.

For more information, see Error-handling conversion functions.

Syntax
TRY_TO_BOOLEAN( <string_expr> )

Copy

Arguments
string_expr

A string expression that can be evaluated to a BOOLEAN value.

Returns

This function returns a value of type BOOLEAN.

Usage notes

The input argument must be a string expression. The function evaluates the string expression in the following way:

The evaluations of the strings are case-insensitive.

Examples

This example uses the TRY_TO_BOOLEAN function:

SELECT TRY_TO_BOOLEAN('True')  AS "T",
       TRY_TO_BOOLEAN('False') AS "F",
       TRY_TO_BOOLEAN('Not valid')  AS "N";

Copy

+------+-------+------+
| T    | F     | N    |
|------+-------+------|
| True | False | NULL |
+------+-------+------+

For more examples, see TO_BOOLEAN.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4