Table of Contents
DATALENGTH Function in SQL Server is easier to understand when the core ideas are paired with practical examples. The sections below explain the topic clearly, highlight useful steps, and point out details that can prevent common errors.
The article will explore and show you how to use the DATALENGTH function in SQL Server to display the number of bytes used to represent an expression.
Describe
The DATALENGTH function in SQL Server returns the length of an expression, in bytes.
Syntax
To use the DATALENGTH function in SQL Server, we use the following syntax:
DATALENGTH(bieu_thuc)
SELECT DATALENGTH('TipsMake.com');Result: 15SELECT DATALENGTH(' TipsMake.com ');Result: 17SELECT DATALENGTH(1234);Result: 4SELECT DATALENGTH('20-02-2019');Result: 10SELECT DATALENGTH(' ');Result: 1SELECT DATALENGTH('');Result: 0SELECT DATALENGTH(NULL);Result: NULL
Next lesson: LEFT function in SQL Server
FAQ
What should you know about describe?
The DATALENGTH function in SQL Server returns the length of an expression, in bytes.
What should you know about syntax?
To use the DATALENGTH function in SQL Server, we use the following syntax:
What is DATALENGTH Function in SQL Server?
The article will explore and show you how to use the DATALENGTH function in SQL Server to display the number of bytes used to represent an expression.
Reader Comments 0
Sign in with email or Google to join the discussion.