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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Identifying a numeric in a string

Author  Topic 

muntman
Starting Member

1 Post

Posted - 2002-12-15 : 18:51:18
In converting some messed up data - I need to find out whether a string contains any numeric values. The brilliant client decided to use the Address3 field to store the City in some cases, and an alphanumeric Medical Identifier in other cases. What I really want is a function like:

IF hasNumeric ('ACC NO QA12345') = TRUE BEGIN ....

I would rather not have to go through the string character by character and test for IsNumeric, but if that is the case, I will happily flog someone elses code!!!

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-12-15 : 19:53:22
well, you could do
if ( PATINDEX('%[0-9]%','ACC NO QA12345') > 0)
begin...

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page
   

- Advertisement -