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 |
|
miichelle.j.tyler
Starting Member
1 Post |
Posted - 2006-05-15 : 16:32:24
|
| I need to identify rows where the 32-character ID field is all numeric. Is that possible using an SQL select statement? Other than the obvious method of searching for the index value of 0-9 for each character in the string... query is too long. |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2006-05-15 : 16:49:11
|
use IsNumeric(column) functionor column not like '%[0-9]%'Go with the flow & have fun! Else fight the flow Blog thingie: [URL="http://weblogs.sqlteam.com/mladenp"] |
 |
|
|
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts |
Posted - 2006-05-16 : 06:33:25
|
Hi all,As usual, beware of the issues of IsNumeric...http://aspfaq.com/show.asp?id=2390 It sounds like spirit1's other suggestion (with a minor typo modification) will do the trick for you in this case, though...declare @t table (v varchar(10))insert @t select 'abc'union all select '23214'union all select '23abc214'union all select '232.14'select * from @t where v not like '%[^0-9]%' Ryan Randallwww.monsoonmalabar.com London-based IT consultancy Solutions are easy. Understanding the problem, now, that's the hard part. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|