Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PATINDEX & CHARINDEX functions #50746

Open
UnamedRus opened this issue Jun 9, 2023 · 2 comments
Open

PATINDEX & CHARINDEX functions #50746

UnamedRus opened this issue Jun 9, 2023 · 2 comments
Labels

Comments

@UnamedRus
Copy link
Contributor

Use case

The PATINDEX() function looks for the first occurrence of a pattern in the input string and returns the starting position of it.

Syntax of PATINDEX() function:

PATINDEX ( ‘%Pattern%’,input_string )

%Pattern%: In this argument, we specify the character expression that we want to look into the specified string. We might include the wild-characters as well in this argument
input_string: It is the string in which we want to search the pattern

CHARINDEX(substring, input_string)

Substring: Here, we define the substring that we want to search in the input string. We can specify a maximum of 8000 characters in this argument
Input_String: In this argument, we define the input string

Just like position, but with COLLATE support

SELECT Charindex('sqlshack.com', 'This is SQLSHACK.COM' COLLATE 
                        latin1_general_cs_as)

Additional context

Those functions exist in MS SQL

@sunshup
Copy link

sunshup commented Jul 3, 2023

When will these be available

@UnamedRus
Copy link
Contributor Author

W/A

with 'Hello, world!'as str
SELECT position(str,extract(str, '(r.d)'));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants