SQL LEN() Function


The LEN() function returns the length of the value in a text field.

Syntax

SELECT LEN(column_name) FROM table_name;

Example

student Table

stud_sidstud_nameBranch
11211Ashwani SinghECE
11212Sachin YadavCSE
11213DeepakMECH
SELECT stud_id LEN(stud_name) AS student_name_length FROM student;
Output
stud_sidstudent_name_length
1121113
1121212
112136

Share this article on