Skip to content

Commit 96b6449

Browse files
committed
Added string Insert article
1 parent d8c4a6d commit 96b6449

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# String_Insert
2+
3+
`String_Insert` returns a new string in which a `value` string is inserted at a specified index position in the `source` string.
4+
5+
```csharp
6+
String_Insert (
7+
@source NVARCHAR (MAX),
8+
@startIndex INT,
9+
@value NVARCHAR (MAX)
10+
)
11+
RETURNS NVARCHAR (MAX)
12+
```
13+
14+
## Parameters
15+
16+
- **source**: The source string.
17+
- **startIndex**: The zero-based index position of the insertion.
18+
- **value**: The string to insert.
19+
20+
## Returns
21+
22+
A new string that is equivalent to the `source` string, but with `value` inserted at position `startIndex`.
23+
24+
## Example
25+
26+
```csharp
27+
SELECT SQLNET::String_Insert('This is a string.', 10, 'new ')
28+
SELECT SQLNET::String_Insert('aaaabbbb', 4, ' ')
29+
```
30+
31+
# String_Insert4k
32+
33+
It is equivalent to `String_Insert` except no NVARCHAR(MAX) parameters; it can be used when input data will never be over 4000 characters as this function offers better performance.
34+
35+
```csharp
36+
String_Insert4k (
37+
@source NVARCHAR (4000),
38+
@startIndex INT,
39+
@value NVARCHAR (4000)
40+
)
41+
RETURNS NVARCHAR (4000)
42+
```
43+
44+
## Example
45+
46+
```csharp
47+
SELECT SQLNET::String_Insert4k('This is a string.', 10, 'new ')
48+
SELECT SQLNET::String_Insert4k('aaaabbbb', 4, ' ')
49+
```

0 commit comments

Comments
 (0)