DATALENGTH() :
This function returns the length of an expression and expression length will be in bytes.
Syntax :
DATALENGTH( expression )
- Parameter - This method accepts a single-parameter as mentioned above and described below as follows.
- Expression - It is an expression of the data type to return the length for. If expression is NULL, it returns NULL.
SELECT DATALENGTH('Geeksforgeeks');
Output :
13Example-2 : Check DATALENGTH() Function count trailing spaces or not.
SELECT DATALENGTH('GFG ');
Output :
6Example-3 : Check DATALENGTH() Function count leading spaces or not.
SELECT DATALENGTH(' GFG');
Output :
7Example-4 : DATALENGTH() Function return NULL, if the expression is NULL.
SELECT DATALENGTH(NULL);Output :
NULL