LENGTH (NoSQL query)

APPLIES TO: NoSQL

Returns the number of characters in the specified string expression.

Syntax

LENGTH(<string_expr>)  

Arguments

Description
string_expr A string expression.

Return types

Returns a numeric expression.

Examples

The following example returns the length of a static string.

SELECT VALUE {
    stringValue: LENGTH("AdventureWorks"),
    emptyString: LENGTH(""),
    nullValue: LENGTH(null),
    numberValue: LENGTH(0),
    arrayValue: LENGTH(["Adventure", "Works"])
}
[
  {
    "stringValue": 14,
    "emptyString": 0
  }
]

Remarks

  • This system function doesn't use the index.