IS_STRING (Azure Cosmos DB)

APPLIES TO: SQL API

Returns a Boolean value indicating if the type of the specified expression is a string.

Syntax

IS_STRING(<expr>)  

Arguments

expr
Is any expression.

Return types

Returns a Boolean expression.

Examples

The following example checks objects of JSON Boolean, number, string, null, object, array, and undefined types using the IS_STRING function.

SELECT   
       IS_STRING(true) AS isStr1,   
       IS_STRING(1) AS isStr2,  
       IS_STRING("value") AS isStr3,   
       IS_STRING(null) AS isStr4,  
       IS_STRING({prop: "value"}) AS isStr5,   
       IS_STRING([1, 2, 3]) AS isStr6,  
       IS_STRING({prop: "value"}.prop2) AS isStr7  

Here is the result set.

[{"isStr1":false,"isStr2":false,"isStr3":true,"isStr4":false,"isStr5":false,"isStr6":false,"isStr7":false}] 

Remarks

This system function will benefit from a range index.

Next steps