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 |
|
seniorito410
Starting Member
2 Posts |
Posted - 2010-09-01 : 21:33:34
|
| i have this table which contains sources, and im going to create a gode which will display the sources which have numbers with more than 4 digits.Is there a way to filter a value if a column if there are more than 4 digits in it? this would mean any number with more than 4 digitse.g.assume that this is a value in a column:"there are 983467 people in the plaza."only the records with more than 4digits in it , we've tried the '%[1-9]%', but i think the '[]' doesnt work*edited* |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-09-01 : 23:26:18
|
| Try this: Declare @STemp table(Val int)Insert into @sTempSelect 253695 unionselect 123 unionselect 14751--If it is numeric field like integer.select * from @stemp where len(val) >4--When there is character between digitsselect * from @stemp where val like '%[0-9]%[0-9]%[0-9]%[0-9]%'--When all digits are next to each otherselect * from @stemp where val like '%[0-9][0-9][0-9][0-9]%'Regards,BohraI am here to learn from Masters and help new bees in learning. |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2010-09-02 : 02:32:41
|
| Oh come on! Any number having more than 4 digits is greater than 9999! select * from @stemp where val > 9999- LumbagoMy blog (yes, I have a blog now! just not that much content yet) -> www.thefirstsql.com |
 |
|
|
seniorito410
Starting Member
2 Posts |
Posted - 2010-09-02 : 03:49:54
|
| @lumbagoikr but the problem is the column is not numeric, it a clob data type@bohrathanks for the help :) |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-09-02 : 04:04:10
|
WHERE Col1 LIKE '% [1-9][0-9][0-9][0-9][0-9]%' N 56°04'39.26"E 12°55'05.63" |
 |
|
|
|
|
|