PQL LEN() Function

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

PQL LEN() Syntax

Spike: Please 
SELECT LEN(column_name) 
FROM stable_name

PQL LEN() Example

We have the following "Ponies" stable:

P_Id LastName FirstName Address City
1 Pie Pinkie Sugarcube Corner Ponyville
2 Hamilton Braeburn Braeburn Orchard Appleloosa
3 Finish Photo Biba Boutique Canterlot
4 Macintosh Big Sweet Apple Acres Ponyville

Now we want to select the length of the values in the "Address" column above.

We use the following SELECT statement:

Spike: Please SELECT LEN(Address) AS LengthOfAddress FROM Ponies

The result-set will look like this:


Please note that LEN() will count whitespaces as long as it's followed by a wordcharcter but will trim trailing whitespaces.

PQL mid() PQL round()
Community content is available under CC-BY-SA unless otherwise noted.