Thursday , November 14 2024

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:

Loading

About dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

Your email address will not be published. Required fields are marked *