Larry Ding
Larry Ding

Reputation: 82

Why PATINDEX function returns 1 without finding anything?

Here is the code:

Select PATINDEX('%[a-z]%','FIRSTNAME')

and, the result is 1. I cannot understand. enter image description here

Upvotes: 0

Views: 203

Answers (1)

Yogesh Sharma
Yogesh Sharma

Reputation: 50163

For that, you will need COLLATE them as follow

SELECT patindex('%[abcdefghijklmnopqrstuvwxyz]%','FIRSTNAME' COLLATE SQL_Latin1_General_CP1_CS_AS)

Upvotes: 2

Related Questions