sql STRING length code example

Example 1: sql string length

SELECT length('abcd') FROM DUAL;		-- 4	DUAL is for Oracle

Example 2: sql string length

-- Relevant for SQL-Oracle only

-- syntax
LENGTH(<your-string>)

-- example
LENGTH('CountCharacters') -- OUTPUT: 15
        123456789012345

-- example with query 
SELECT 'CountCharacters',LENGTH('CountCharacters')
FROM DUAL;

-- OUTPUT: CountCharacters, 15

Example 3: sql length

-- Relevant for MS SQL (SQL Server)
LEN('string')

Example 4: lenght sql

SELECT LENGTH('exemple');

Tags:

Sql Example