I need to create a rule only for alphabet characters
i used the following Wildcard character sequences but didn't work !
LIKE '[A-Za-z]'
LIKE 'a-z'
LIKE 'A-Za-z'
SQL Server LEFT() Function The LEFT() function extracts a number of characters from a string (starting from left).
The LIKE operator is used in a WHERE clause to search for a specified pattern in a column. There are two wildcards often used in conjunction with the LIKE operator: The percent sign (%) represents zero, one, or multiple characters. The underscore sign (_) represents one, single character.
How do I select only alpha characters in SQL? SELECT productname, SUBSTRING(Name,1,ISNULL(NULLIF(PATINDEX('%[^A-Za-z. ''0-9]%',LTRIM(RTRIM(productname))),0)-1,LEN(productname))) AS noSpecials.
Double negative like
WHERE
SomeCol NOT LIKE '%[^a-z]%'
Ignoring the first NOT, this means "match any character not in the range a to z".
Then, you reverse using the first NOT which means "don't match any character not in the range a to z"
Edit, after comment
LIKE '%[a-z]%'
means "find any single character between a-z. So 111s222
is matched for example because s
matches in this like.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With