## Syntax
```mermaid
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> NORMALIZE[NORMALIZE]:::quoted
NORMALIZE --> FUNCPARS1["("]:::quoted
FUNCPARS1 --> FUNCPARS2[parameters]
FUNCPARS2 --> FUNCPARS3[")"]:::quoted
FUNCPARS3 --> End((END))
```
## Purpose
The `NORMALIZE` SQL function normalizes a file path for use as a filename by replacing all characters invalid for use in a file path by an underscore. Also, non-ASCII characters are replaced by an underscore. The resulting file path is simplified by various operations such as de-duplication of consecutive whitespace and underscore characters.
Parameters:
- Original file path: path of the file.
- Maximum file name length: length in characters into which the normalized file name must fit.
- Allow path separator: whether to allow the path separators `\` and `/` in the normalized file name. When not, occurrences are replaced by an underscore.
Returns: a normalized file path.
## Examples
The following example creates a valid filename from a text:
```sql
select normalize('myfile 4%5^6&7*8(9)0?1\2', 240, true)
--------------------
myfile 4%5^6&7_8(9)0_1_2
```
The following example create a valid file name with path separators from a text:
```sql
select normalize('mypath 4%5^6&7*8(9)0?1\my file.txt', 240, false)
--------------------
mypath 4%5^6&7_8(9)0_1\my file.txt
```