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
 Transact-SQL (2000)
 parsing char values

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-04-05 : 07:59:59
diane writes "I am writing a proc that retrieves data from a field that contains char and/or integer values. I would like to eliminate char values when encountered and do a conversion on the integer values. obviously, every time my procedure runs and it encounters a char values the conversion part of the proc fails due to datatype errors. Is there a way, in a T-SQL procedure to parse out the char values???"

ToddV
Posting Yak Master

218 Posts

Posted - 2002-04-05 : 09:04:15
Check out the Fundtion ISNUMERIC()

Go to Top of Page

Jay99

468 Posts

Posted - 2002-04-05 : 09:41:29
ISNUMERIC() determines whether an expression is a valid numeric type. It does not 'parse'.

You probably need to use REPLACE with some form of regular expression.

REPLACE(columnname, '[a-zA-Z]','')

 
Maybe someone has a better solution?

Jay
<O>
Go to Top of Page
   

- Advertisement -