Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AsimKhaliq
Yak Posting Veteran
94 Posts |
Posted - 2003-12-06 : 12:43:51
|
| HiI have to check that left(Field,4) is alphabat, is there any function or method to check it.For Example we use IsNumeric(Field) for number. So are there any functions for characterThanks in Advance |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-12-06 : 13:01:12
|
| PATINDEX('%[^a-z]%', @YourString)If that returns 0, all characters are between a and z. otherwize, there's at least one that's not.- Jeff |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-12-09 : 10:15:33
|
To expand on Jeff's post, and to make it act like the other function you mention, and because it seems to be handy anyway (and why ms didn't incluse it...)CREATE FUNCTION IsAlphabetic (@String varchar(8000))RETURNS intASBEGIN DECLARE @rc int SELECT @rc = CASE WHEN PATINDEX('%[^a-z]%', @String) = 0 THEN 1 ELSE 0 ENDRETURN @rcENDSELECT dbo.IsAlphabetic('abc') Happy interogating...Brett8-) |
 |
|
|
|
|
|