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/as_object below:

Website Navigation


AS_OBJECT | Snowflake Documentation

Categories:

Semi-structured and structured data functions (Cast)

AS_OBJECT

Casts a VARIANT value to an OBJECT value.

See also:

AS_<object_type> , AS_ARRAY

Syntax
AS_OBJECT( <variant_expr> )

Copy

Arguments
variant_expr

An expression that evaluates to a value of type VARIANT.

Returns

The function returns a value of type OBJECT or NULL:

Usage notes Examples

Create a table and load data into it:

CREATE OR REPLACE TABLE as_object_example (object1 VARIANT);

INSERT INTO as_object_example (object1)
  SELECT TO_VARIANT(TO_OBJECT(PARSE_JSON('{"Tree": "Pine"}')));

Copy

Use the AS_OBJECT function in a query to cast a VARIANT value to an OBJECT value:

SELECT AS_OBJECT(object1) AS object_value
  FROM as_object_example;

Copy

+------------------+
| OBJECT_VALUE     |
|------------------|
| {                |
|   "Tree": "Pine" |
| }                |
+------------------+

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