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 2005 Forums
 Transact-SQL (2005)
 How to check numeric value

Author  Topic 

ruchirj07
Starting Member

37 Posts

Posted - 2008-01-28 : 08:37:39
Hi,

I have some values in table say ; 152, 152-abc, 152-xyz, abc-152, 153,210 etc etc

is there any function in sql server which can fetch me only real numbers out of this lot? (152,153,210)

or else i have to write a stored procedure for the same?

Ruchir

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-01-28 : 08:41:10
Where isNumeric(<column>) will get you 99.9 percent of the way. isNumeric may return some false positives but if that is the case post some examples and we can tell you how to deal with it.

Be One with the Optimizer
TG
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-01-28 : 08:42:33
SELECT * FROM Table1 WHERE NOT Col1 LIKE '%[^0-9]%'



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-28 : 09:13:08
and if you want to take care of decimal palces as well, then

where isnumeric(col+'d0')=1

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -