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 |
cipriani1984
Constraint Violating Yak Guru
304 Posts |
Posted - 2009-03-06 : 06:48:59
|
Hi,If i wanted to return rows where the field in them only has numbers how would I go about doing that? for instance in access:WHERE Field like '#'which is the wildcard, is there equivalent in sql? |
|
Ifor
Aged Yak Warrior
700 Posts |
Posted - 2009-03-06 : 07:02:18
|
[code]WHERE YourColumn NOT LIKE '%[^0-9]%'[/code] |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2009-03-06 : 07:03:13
|
If you want it limit to only NUMBERS ONLY (as in characters 0 to 9 - no decimals - no commas - no spaces thenDECLARE @bar TABLE ( [foo] VARCHAR(50) )INSERT @bar SELECT '1'UNION SELECT '10.1'UNION SELECT 'foo'UNION SELECT 'foo 1'UNION SELECT '435'SELECT fooFROM @barWHERE foo NOT LIKE '%[^0-9]%' There is an ISNUMERIC function but it frequently gets things wrong.If that isn't enough then post some sample data and expected results.Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|