Table of Contents

Search

  1. Preface
  2. Function reference
  3. Constants
  4. Operators
  5. Dates
  6. Functions
  7. System variables
  8. Datatype reference

Function Reference

Function Reference

LENGTH

LENGTH

Returns the number of characters in a string, including trailing blanks.

Syntax

LENGTH(
string
)
Argument
Required/
Optional
Description
string
Required
String datatype. The strings you want to evaluate. You can enter any valid expression.

Return Value

Integer representing the length of the string.
NULL if a value passed to the function is NULL.

Example

The following expression returns the length of each customer name:
LENGTH( CUSTOMER_NAME )
CUSTOMER_NAME
RETURN VALUE
Bernice Davis
13
NULL
NULL
John Baer
9
Greg Brown
10

Tips

Use LENGTH to test for empty string conditions. If you want to find fields in which customer name is empty, use an expression such as:
IIF( LENGTH( CUSTOMER_NAME ) = 0, 'EMPTY STRING' )
To test for a null field, use ISNULL. To test for spaces, use IS_SPACES.

0 COMMENTS

We’d like to hear from you!