Site icon Database Tutorials

DATALENGTH Function in SQL Server(TSQL)

With the DATALENGTH function, we can calculate the size of the data in a column in bytes. Usually, its useful for calculating the size of lob columns.

Let’s make examples for a better understanding of DATALENGTH Function.

Example:

First, we create a table with the help of the following script and add a few records into this table.

After creating the table, I will add 3 records to my table using the following script.

DATALENGTH Function Usage:

Exit mobile version