DataSize Function Examples | VantageCloud Lake - DataSize Examples - Teradata VantageCloud Lake

Lake - Working with SQL

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
jbe1714339405530.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
jbe1714339405530

The following examples use JSON data types.

SELECT TD_SYSFNLIB.DataSize (NEW JSON ('{"name" : "Mitzy", "age" : 3}'));

Result:

datasize( NEW JSON('{"name" : "Mitzy", "age" : 3}', LATIN))
-----------------------------------------------------------
                                                         29
CREATE TABLE JSON_table (id INTEGER, jsn JSON INLINE LENGTH 1000);

INSERT INTO JSON_table VALUES (100, '{"name" : "Mitzy", "age" : 3}');
INSERT INTO JSON_table VALUES (200, '{"name" : "Rover", "age" : 5}');
INSERT INTO JSON_table VALUES (300, '{"name" : "Princess", "age" : 4.5}');

SELECT * FROM JSON_table ORDER BY id;

Result:

         id jsn
----------- ------------------------------------------
        100 {"name" : "Mitzy", "age" : 3}
        200 {"name" : "Rover", "age" : 5}
        300 {"name" : "Princess", "age" : 4.5}
SELECT id, TD_SYSFNLIB.DataSize (jsn) FROM JSON_table ORDER BY id;

Result:

         id         datasize(jsn)
-----------  --------------------
        100                    29
        200                    29
        300                    34