Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The TOSTRING
function returns a string representation of a value.
An Azure Cosmos DB for NoSQL system function that returns a value converted to a string.
Syntax
TOSTRING(<expr>)
Arguments
Description | |
---|---|
expr |
Any expression. |
Return types
Returns a string expression.
Examples
This section contains examples of how to use this query language construct.
Convert values to string
In this example, the TOSTRING
function is used to convert multiple scalar and object values to a string.
SELECT VALUE {
integerToString: TOSTRING(125),
floatToString: TOSTRING(0.1234),
booleanToString: TOSTRING(false),
arrayToString: TOSTRING([ 1, 2, 3 ]),
objectToString: TOSTRING({ "department": "Bicycles" }),
stringToString: TOSTRING("Hello World"),
undefinedToString: TOSTRING(undefined),
notANumberToString: TOSTRING(NaN),
infinityToString: TOSTRING(Infinity)
}
[
{
"integerToString": "125",
"floatToString": "0.1234",
"booleanToString": "false",
"arrayToString": "[1,2,3]",
"objectToString": "{\"department\":\"Bicycles\"}",
"stringToString": "Hello World",
"notANumberToString": "NaN",
"infinityToString": "Infinity"
}
]
Remarks
- This function doesn't utilize the index.