Skip to content

Commit 3f81083

Browse files
committed
Add STARTSWITH
1 parent 5db8458 commit 3f81083

File tree

1 file changed

+8
-24
lines changed

1 file changed

+8
-24
lines changed

articles/cosmos-db/nosql/query/startswith.md

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.reviewer: sidandrews
88
ms.service: cosmos-db
99
ms.subservice: nosql
1010
ms.topic: reference
11-
ms.date: 07/01/2023
11+
ms.date: 07/24/2023
1212
ms.custom: query-reference
1313
---
1414

@@ -21,16 +21,16 @@ Returns a boolean value indicating whether the first string expression starts wi
2121
## Syntax
2222

2323
```sql
24-
ENDSWITH(<str_expr_1>, <str_expr_2> [, <bool_expr>])
24+
STARTSWITH(<string_expr_1>, <string_expr_2> [, <bool_expr>])
2525
```
2626

2727
## Arguments
2828

2929
| | Description |
3030
| --- | --- |
31-
| **`str_expr_1`** | A string expression. |
32-
| **`str_expr_2`** | A string expression to be compared to the beginning of `str_expr_1`. |
33-
| **`bool_expr`** *(Optional)* | Optional value for ignoring case. When set to `true`, `ENDSWITH` does a case-insensitive search. When unspecified, this default value is `false`. |
31+
| **`string_expr_1`** | A string expression. |
32+
| **`string_expr_2`** | A string expression to be compared to the beginning of `string_expr_1`. |
33+
| **`bool_expr`** *(Optional)* | Optional value for ignoring case. When set to `true`, `STARTSWITH` does a case-insensitive search. When unspecified, this default value is `false`. |
3434

3535
## Return types
3636

@@ -40,25 +40,9 @@ Returns a boolean expression.
4040

4141
The following example checks if the string `abc` starts with `b` or `ab`.
4242

43-
```sql
44-
SELECT VALUE {
45-
endsWithWrongPrefix: STARTSWITH("abc", "b"),
46-
endsWithCorrectPrefix: STARTSWITH("abc", "ab"),
47-
endsWithPrefixWrongCase: STARTSWITH("abc", "Ab"),
48-
endsWithPrefixCaseInsensitive: STARTSWITH("abc", "Ab", true)
49-
}
50-
```
51-
52-
```json
53-
[
54-
{
55-
"endsWithWrongPrefix": false,
56-
"endsWithCorrectPrefix": true,
57-
"endsWithPrefixWrongCase": false,
58-
"endsWithPrefixCaseInsensitive": true
59-
}
60-
]
61-
```
43+
:::code language="sql" source="~/cosmos-db-nosql-query-samples/scripts/startswith/query.sql" highlight="2-5":::
44+
45+
:::code language="json" source="~/cosmos-db-nosql-query-samples/scripts/startswith/result.json":::
6246

6347
## Remarks
6448

0 commit comments

Comments
 (0)